[Question] Is there any way to generate Header link for ClientOnly contents? #3570
-
I made something like this: <script>
import MarkdownIt from 'markdown-it'
import MarkdownItAnchor from 'markdown-it-anchor'
const shuffleArray = (array) => {
for (let i = array.length - 1; i > 0; i--) {
const j = Math.floor(Math.random() * (i + 1));
[array[i], array[j]] = [array[j], array[i]];
}
return array;
}
const test = shuffleArray([
`
### foo
content foo
`,
`
### bar
content bar
`,
])
const md = (new MarkdownIt()).use(MarkdownItAnchor, { permalink: MarkdownItAnchor.permalink.linkInsideHeader()})
const testHtml = md.render(test.join(''))
</script>
## foo-bar
<ClientOnly><div v-html="testHtml"></div></ClientOnly> It works just fine, except for one thing: the header links inside the array can't be generated by toc in sidebar, and the permalink isn't working too. |
Beta Was this translation helpful? Give feedback.
Answered by
Mister-Hope
Oct 26, 2023
Replies: 1 comment
-
You may need to customize https://github.com/mdit-vue/mdit-vue/tree/main/packages/plugin-headers#shouldallownested |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
Mister-Hope
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You may need to customize https://github.com/mdit-vue/mdit-vue/tree/main/packages/plugin-headers#shouldallownested