Issue parsing nested HTML elements
See original GitHub issueFirst of all thanks for you work on the library. We’ve recently adopted it and encountered an issue when trying to parse and render some markdown mixed with HTML (which is there to provide backwards compatibility with another system, hence can’t be removed).
In fact when trying to parse three nested <div>
s:
<div>
<div>
<div></div>
</div>
</div>
markdown-to-jsx
will output this:
<div>
<div></div>
<div></div>
</div>
<p></div></p>
It can be reproduced on the demo site, and it seems to happen when triple-nesting any HTML element. The issue looks similar to https://github.com/probablyup/markdown-to-jsx/issues/168 but I’m not sure if it’s exactly the same problem.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:10
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Problems when parsing nested html tags from string
I have this code that's to parse a string into html and display the text of each element. That's working good except when...
Read more >Fix 'cannot parse selector' error for nested HTML elements
We've forked the parser we use for CSS-in-JS into stylelint organisation, and we're looking for help to fix our fork to close this...
Read more >Possible bug with not parsing "<", "&", ">" correctly in code ...
Hi - I'm working with Github Pages and Jekyll and I've run into an issue with the characters “<”, “>”, and “&” showing...
Read more >Understanding Success Criterion 4.1.1
4.1.1 Parsing: In content implemented using markup languages, elements have complete start and end tags, elements are nested according to their ...
Read more >Nested tag parsing problem
… where html_form_tag displays an html form that includes the parsed results of the nested_tag output. This doesn't: {logging_tag} log this: ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
True, but none of those are small enough to fit the size requirement of this library. It will never be perfect, but it’s good enough for most use cases.
On Sat, Oct 12, 2019 at 9:36 AM James Thistlewood notifications@github.com wrote:
Ok, so I’ve taken a long look at this. The problem basically stems from the fact that regex is being used to parse HTML. HTML is not a regular language, and you cannot use regex to parse it. You can make it seem like it works, but it will never properly work, hence bugs like this.
I’d recommend using a real XML/HTML parser instead.