Skip to content
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

Custom prose img components will cause hydration mismatch #212

Closed
enpitsuLin opened this issue May 20, 2024 · 2 comments
Closed

Custom prose img components will cause hydration mismatch #212

enpitsuLin opened this issue May 20, 2024 · 2 comments

Comments

@enpitsuLin
Copy link

enpitsuLin commented May 20, 2024

I try override prose component <ProseImg/> to show caption under image in nuxt/content template, but got hydration mismatch warning, I thought it was cause by content module(nuxt/content#2640), but this issue also be found in MDC playground

I just add <figure/> and <figurecaption/>, after several try that I realized if there are some unexpected element wrap it would cause hydration mismatch, but cant resolve it

image

Reproduction

https://stackblitz.com/edit/github-1szhfr

@enpitsuLin
Copy link
Author

Just figured out the <figure/> is block element cant be placed in the paragraph or those elements which not flow elements

@stared
Copy link

stared commented Oct 13, 2024

@enpitsuLin How did you solve this one?

Markdown parser automatically wraps things in paragraphs.

EDIT: I see it can be solved by the following hack nuxt/content#1537 (comment).


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants