New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
H2 anchors generated incorrectly if content generated dynamically #3133
Comments
Inferring IDs from dynamic content is not possible while converting markdown to vue. You'll need to do something like #960 (comment) (update it to add aria-label, etc.) |
If it is not possible, then maybe it would be helpful to print a warning during build that it is not possible. The resulting page does not work properly due to problems with hydration. Would be great to catch that during build. |
We use this script to check anchors are valid:
We also use this md plugin, but I don't remember if it is about this issue: https://github.com/iconify/website/blob/main/.vitepress/markdown/html.ts |
Describe the bug
Generating the page structure from data is incorrect if the level of h2 headers has to be generated:
Resulting HTML uses the wrong
id
for allh2
elements. Instead of deriving the anchor id from the rendered text, the JavaScript expressionrepo-name
is used:This also seems to cause problems with hydration, probably because the ids are not unique.
Reproduction
See https://stackblitz.com/edit/vite-avxyva?file=docs%2Fexample.md
Expected behavior
The 'id' for each 'h2' element is generated properly from the actual text content:
System Info
Additional context
No response
Validations
The text was updated successfully, but these errors were encountered: