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

Markdown line that starts with <u> html tag has inconsistent behavior #523

Open
MikeBeasterfeld opened this issue Oct 26, 2023 · 0 comments

Comments

@MikeBeasterfeld
Copy link

There is some behavior that I wouldn't expect when working with markdown with html tags. I added the below tests to index.component.spec.tsx

it('test for markdown paragraph and html tags', () => {
  render(
    <Markdown
      options={{
        overrides: {
          p: {
            component: 'p',
          },
        },
      }}
    >
      {'Other text <u>Underline</u>\n'}
    </Markdown>
  )

  expect(root.innerHTML).toMatchInlineSnapshot(`
  <p>
    Other text
    <u>
      Underline
    </u>
  </p>
  `)
})

it('test for markdown paragraph and start line with html tag', () => {
  render(
    <Markdown
      options={{
        overrides: {
          p: {
            component: 'p',
          },
        },
      }}
    >
      {'<u>Underline</u> Other text\n'}
    </Markdown>
  )

  expect(root.innerHTML).toMatchInlineSnapshot(`
  <p>
    <u>
      Underline
    </u>
    Other text
  </p>
  `)
})

The first test passes as expected. However the second test generates the following:

<div>
  <u>
    Underline
  </u>
  Other text
</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

1 participant