Skip to content
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

Bug Rending <div><div><div> </div></div></div> #520

Closed
yzhou88 opened this issue Oct 8, 2023 · 2 comments
Closed

Bug Rending <div><div><div> </div></div></div> #520

yzhou88 opened this issue Oct 8, 2023 · 2 comments
Assignees

Comments

@yzhou88
Copy link

yzhou88 commented Oct 8, 2023

Rendering
<div><div><div></div></div></div>
Gives this result:
</div>

Please try it in the playground.
Playground

@yzhou88
Copy link
Author

yzhou88 commented Oct 8, 2023

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?

@quantizor quantizor self-assigned this Mar 13, 2024
Innei pushed a commit to Innei/markdown-to-jsx that referenced this issue Mar 28, 2024
@joehe00
Copy link

joehe00 commented Apr 14, 2024

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>&lt;/div&gt;</code></pre></div>

  it('', () => {
    render(compiler(`<div>
    <div><div></div></div>
    </div>`))

    expect(root.innerHTML).toMatchInlineSnapshot(`
      <div>
        <div>
          <div>
          </div>
        </div>
      </div>
    `)
  })

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants