Open privatenumber opened 11 months ago
Upon trying to open a fix, I realized critters
will apply the same fix too, moving the h1
out of the p
tag. Also prettier
complains if there's a h1
inside of a p
tag.
This may have to be fixed on the HTML generation side when parsing the markdown.
Describe the bug
vite-ssg
generates mismatching server-generated and frontend HTML.Specifically, this is happening because JSDOM is used to modify the input HTML structure during the server-side rendering process.
Input
JSDOM Output
JSDOM is changing the input HTML structure. It is moving the
h1
tag outside of thep
tag.So technically, this is actually correct behavior because apparently by HTML spec,
h1
tag cannot be inside ap
tag.However, in my case, the HTML is generated by
vite-plugin-vue-markdown
(which usesmarkdown-it
) when I provide it with the following input:Proposed solution
Using
happy-dom
instead ofjsdom
yields the expected behavior.Happy DOM Output
Reproduction
https://stackblitz.com/edit/stackblitz-starters-pcu9op?file=index.mjs
System Info
Used Package Manager
npm
Validations