INNER CODE UNIT · JavaScript
nodeOffsets
tradingview/lightweight-charts · website/plugins/docs-markdown/index.js:331
function nodeOffsets(node) {
const start = node.position?.start.offset;
const end = node.position?.end.offset;
return typeof start === 'number' && typeof end === 'number' ? [start, end] : null;
}
/**
* Text content of a node, ignoring MDX import/expression constructs so a
* heading's trailing `{#anchor}` (an mdxTextExpression) never leaks in.
*
* @param {MdastNode} node
* @returns {string}
*/
function nodeText(node) {
if (MDX_REMOVE_WHOLE.has(node.type)) {
return '';
}
if (typeof node.value === 'string') {