diff --git a/src/plugins/remark-heading-extractor.mjs b/src/plugins/remark-heading-extractor.mjs index 28e417c..9a9d10e 100644 --- a/src/plugins/remark-heading-extractor.mjs +++ b/src/plugins/remark-heading-extractor.mjs @@ -8,7 +8,7 @@ export function remarkHeadingExtractor() { visit(tree, 'heading', (node) => { const rawText = toString(node); - const text = rawText.split('\n')[0].replace(/<[^>]+>/g, '').trim(); + const text = rawText.split('\n')[0].replace(/<[^>]*>/g, '').trim(); const id = text.toLowerCase().replace(/\s+/g, '-').replace(/[^\w-]/g, '') + rawText.split('\n')[0].match(/href="([^"]+)"/, '')[1].trim();; const level = node.depth;