INNER CODE UNIT · JavaScript
collectCleanup
tradingview/lightweight-charts · website/plugins/docs-markdown/index.js:372
function collectCleanup(node, ctx) {
if (MDX_REMOVE_WHOLE.has(node.type)) {
const range = nodeOffsets(node);
if (range) {
ctx.edits.push({ start: range[0], end: range[1] });
}
return;
}
if (MDX_JSX.has(node.type)) {
collectJsxCleanup(node, ctx);
return;
}
if (node.type === 'heading' && typeof node.depth === 'number' && node.depth >= 2 && node.depth <= 4) {
const text = nodeText(node).replace(/\s+/g, ' ').trim();
if (text.length > 0) {
ctx.headings.push({ depth: node.depth, text });
}
}