markdown-to-jsx icon indicating copy to clipboard operation
markdown-to-jsx copied to clipboard

Cannot render tag if formatted in a certain way.

Open Khongchai opened this issue 1 year ago • 2 comments

If we do this

const string = `<p>
Item detail
<span
  style="
    color: #fddb67;
    font-size: 11px;
    font-style: normal;
    font-weight: 500;
    line-height: 18px;
    text-decoration-line: underline;
  "
  >debug item 1</span
>
</p>`;


<Markdown>{string}</Markdown>

This error would be thrown image

But if we inline the entire string, the content is rendered correctly with no errors

const string = `<p> Item detail <span style=" color: #fddb67; font-size: 11px; font-style: normal; font-weight: 500; line-height: 18px; text-decoration-line: underline; ">debug item 1</span> </p>`;

Not sure why this happens, but we were using another library and it was rendering the first version just fine.

Khongchai avatar Jan 24 '24 09:01 Khongchai

I wonder if this is the same as #449.

If you put your markdown in here: https://markdown-to-jsx.quantizor.dev/

The output you get is: Item detail debug item 1</span > </p>

janpe avatar Feb 01 '24 11:02 janpe

@quantizor is this an issue you are aware about? Do you have any thoughts on it? For me it is currently something that prevents me from using the library which I would otherwise be very happy to use

janpe avatar Feb 01 '24 11:02 janpe

Hi, yes likely a case of some regexes not accounting for newlines properly. Will look into it

quantizor avatar Mar 13 '24 18:03 quantizor