From ea9e56459cad80ed078276f6b81d91efef795a11 Mon Sep 17 00:00:00 2001 From: EveSunMaple Date: Sat, 28 Dec 2024 23:43:01 +0800 Subject: [PATCH] chore: backtrack --- src/plugins/remark-heading-extractor.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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;