-
-
Notifications
You must be signed in to change notification settings - Fork 916
Description
Hey!
The issue reproduces with almost any self-closing tag like input
or area
, but br
seems to have no issues.
If I try to parse just this
<img src="/images/someImage.jpg" />
I get an error thrown:
Invariant Violation: img is a void element tag and must neither have
children
nor usedangerouslySetInnerHTML
.
Something more complex, like a blog post that contains several img
tags gets me:
Weirdly enough, a blog post that contains a single img
properly works ...
This is an example that is giving me troubles: https://gist.github.com/rolandleth/b182260ba423c3e65923fe382e000c9e
I tried lurking for a few hours, but I don't have the experience to actually debug it. I thought I found some solutions, but nothing properly worked. For example React does this check: !(props.children == null && props.dangerouslySetInnerHTML == null)
, but the passed in children
is an empty array for the img
tag; but not always 😑. It's clear I have no real idea what I'm doing.
Would you have time to test the library with the example I provided?
I'm using
<ReactMarkdown
source={this.state.post.body}
escapeHtml={false}
/>
but I also tried custom parsers, like in the docs, with astPlugins={[parseHtml]}
. Although it might just be that I didn't know how to configure them 😞
Let me know if and how I can help.
Thanks and have a great day! 🌞