mdx-js/mdx

Markdown Image gets wrapped inside Paragraph

Closed this issue · 3 comments

This might be the intended behaviour, anyways it seems unintended to wrap an image inside the paragraph component.

e.g.

![Image of Yaktocat]({URL})

becomes

<ParagraphComponent>
    <ImageComponent/>
<ParagraphComponent/>

That’s how Markdown behaves, AFAIK. Maybe writing HTML code instead will prevent the paragraph component.

johno commented

A while back I wrote a plugin to unwrap images when desired (@silvenon is correct in that being the default behavior of md).

Looks like I haven't pushed that package to GitHub yet, will do so today.

Edit: This will remain as is in MDX, too, since its the default. But one can bring in this plugin to achieve the desired results in userland.

Eventually you will be able to write JSX in order to avoid wrapping in paragraphs. Currently this causes bugs, as described in #246 (comment), but we're working on it. Once that is resolved you will be able to write <img src="..." /> and it will not be wrapped in a paragraph.

To avoid tracking multiple issues of the same problem, I'm closing this in favor of #246.