markdown-to-jsx
markdown-to-jsx copied to clipboard
Bug Rending <div><div><div> </div></div></div>
Rendering
<div><div><div></div></div></div>
Gives this result:
</div>
Please try it in the playground. Playground
Looks like it is caused by the regular expression. But it is too complicated to fix:
const HTML_BLOCK_ELEMENT_R = /^ *(?!<[a-z][^ >/]* ?\/>)<([a-z][^ >/]*) ?([^>]*)\/{0}>\n?(\s*(?:<\1[^>]*?>[\s\S]*?<\/\1>|(?!<\1)[\s\S])*?)<\/\1>\n*/i
Can the author fix this issue?
It resolves the issue mentioned in the original ticket, but failed for test below and generate string:
<div><div><div></div><div></div></div><pre><code></div></code></pre></div>
it('', () => {
render(compiler(`<div>
<div><div></div></div>
</div>`))
expect(root.innerHTML).toMatchInlineSnapshot(`
<div>
<div>
<div>
</div>
</div>
</div>
`)
})