erusev / parsedown

Better Markdown Parser in PHP
https://parsedown.org
MIT License
14.69k stars 1.12k forks source link

Unordered list followed by horizontal rule produces incorrect HTML #818

Open multiwebinc opened 2 years ago

multiwebinc commented 2 years ago

According to https://spec.commonmark.org/0.30/#thematic-breaks, for thematic breaks,

[s]paces and tabs are allowed between the characters:

Therefore, we can use - - - (with spaces in between), which should produce a <hr /> tag in the HTML.

This works in parsedown, except when the hr is after a ul:

- List item

- - -

This incorrectly produces the HTML:

<ul>
<li>
<p>List item</p>
</li>
<li>
<ul>
<li>-</li>
</ul>
</li>
</ul>

Expected output:

<ul>
<li>List item</li>
</ul>

<hr />