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

Inline HTML breaks subsequent markdown links in same line

Open ghost opened this issue 5 years ago • 1 comments

In this paragraph of markdown, the second link isn't parsed by markdown-to-jsx:

Evidence-wise, cognitive restructuring is a component of cognitive-behavioral therapy, which is a strongly supported treatment for a variety of problems<a href="#hofmann2012efficacy"><sup>[1]</sup></a>. Since there seems to be less research on the technique as a standalone therapy, it's likely best used together with behavioral methods like [behavioral activation](/behavioral-activation).

Is that expected behavior?

ghost avatar May 24 '20 00:05 ghost

Pasting your example in https://markdown-to-jsx.quantizor.dev/ works like expected.

This example is not working like expected:

<a href="/test">2</a> test [link](/link)
more

This example is working like expected:

a <a href="/test">2</a> test [link](/link)
more

Update: After debugging the examples I found the following problem:

In the working example a paragraph is parsed and inside this paragraph the html-block. The markdown-link is parsed correctly as inline (part of pragraph)

In the not working example there is no paragraph. The html-block is checked before the paragraph (higher priority). After the html-block is parsed no paragraph is detected, because it is not the beginning of a line. The markdown-link is not parsed because it is not inline (part of paragraph) but links have to be inline

schalterDev avatar Jun 13 '24 21:06 schalterDev

Should be fixed in v9

quantizor avatar Nov 26 '25 13:11 quantizor