-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
[gatsby-plugin-mdx] Images within <figure> nested within <p> tags are invalid #16239
Comments
This might require making sure that |
I'm also experiencing this issue. Only when writing an alt text in Markdown like so:
It seems like it doesn't matter if I configure |
I just stumbled over this too. In my gatsby config i use the mdx plugin together with the remarkplugin like this:
and my images are rendered with this error in the console:
It renders but the error is of course annoying, is there anything I can do to get this fixed? |
Maybe related to this? #15486 |
I am having this same issue but with the gatsby embed video or gatsby responsive iframe, one of them creates a |
Found a workaround for the image issue, just add const mdxImageWrapFix = {
resolve: `gatsby-plugin-mdx`,
options: {
plugins: [`gatsby-remark-images`],
remarkPlugins: [require('remark-unwrap-images')],
gatsbyRemarkPlugins: [
'gatsby-remark-images',
],
},
}, I guess it should be easy to adapt this plugin to embedded video and others as well. |
Is there an official fix coming for this yet? I have the same problem.
|
thanks for the tip @muuvmuuv worked for me once I removed the markdownCaptions option from my gatsby-remark-images options. |
Issue with embedding video that gives
|
Running into a similar issue with Using the config weirdpattern/gatsby-remark-embed-gist#12 gives these errors:
|
Be careful, everything might appear to be working, however when running the production build and reloading a page where this error is thrown, a bunch of other elements are blown by this. When navigating away and back, all looks good so this only triggers on first load / forced reload. Using the unwrap plugin, you can actually enable the image captions and everything works fine. I followed this approach: #24832 (comment) On the issue with the video component, I have now resorted to write my own wrapper component, which bypasses all the markdown nesting issues and allows better control of the settings (like using nocookie). There is a lovely samplecode at https://www.gatsbyjs.com/docs/how-to/images-and-media/working-with-video/ |
similar issue.
|
Hi! I'm closing this as a stale issue as in the meantime Gatsby 4 and related packages were released. You can check our Framework Version Support Page to see which versions currently receive active support. Please try the mentioned issue on the latest version (using the Thanks! |
I got this error
|
Description
When using
gatsby-plugin-mdx
withgatsby-remark-images
, images written in Markdown are being wrapped in a<p>
tag, which fails React's DOM nesting validation because elements like<figure>
and<figcaption>
(which area generated bygatsby-remark-images
) are not valid with<p>
tags.Steps to reproduce
Render a Markdown image:
In a Gatsby site using
gatsby-plugin-mdx
andgatsby-remark-images
.Expected result
The image would not be nested within a paragraph tag.
Actual result
The image is nested within a
<p>
tag, which caused DOM validation to fail:Environment
The text was updated successfully, but these errors were encountered: