fix(markdown): include content of all tokens in heading ids

closes #4561

BREAKING CHANGES: The heading ids might change in some cases if you're using special (non-html) elements in headings. Please update the broken links to fragments if you find any. To revert back to the older behavior you can customize `markdown.anchor.getTokensText`.
pull/4566/head
Divyansh Singh 7 months ago
parent 6031dbcdb7
commit 68dff2af85

@ -263,6 +263,12 @@ export async function createMarkdownRenderer(
// mdit-vue plugins
md.use(anchorPlugin, {
slugify,
getTokensText: (tokens) => {
return tokens
.filter((token) => token.type !== 'html_inline')
.map((token) => token.content)
.join('')
},
permalink: anchorPlugin.permalink.linkInsideHeader({
symbol: '​',
renderAttrs: (slug, state) => {

Loading…
Cancel
Save