Closed hendraaagil closed 1 year ago
Instead of unwrapping the image from the paragraph yourself, you can use the https://github.com/remarkjs/remark-unwrap-images plugin. It removes the wrapping paragraph.
import remarkUnwrapImages from 'remark-unwrap-images'
<MDXRemote
options={{
mdxOptions: {
remarkPlugins: [
remarkUnwrapImages,
]
}
}}
/>
Thanks @timomeh! That plugin works perfectly for me.
I have a markdown like this to display an image:
I want to wrap that image using
figure
element. So, in Paragraph component I add condition like this:In development server, it rendered correctly
But, after I build and start the (production) server. It rendered
p
instead offigure
elementAfter that, I find that
children.type.name
value can be either'H'
or'P'
when I start in production server. So, my solution is adding a condition like this 😅But, anyone know how this can happen? Because it confused me.
Thanks.