Certain HTML tags when messed up when multiline, and as far as I can tell it's the ones that are display:block by default.
Found on v2.3.6, installed from the FreeBSD py37-markdown2 port; I checked out the repo and ran v2.3.8 to make sure and it was not fixed.
Testcases (I use <wc> because I originally ran into this with a custom web component):
Produces (incorrect):
<p><wc></p>
<div>
</div>
<p></wc></p>
Produces (incorrect):
<p><wc></p>
<pre>
</pre>
<p></wc></p>
Produces (incorrect):
<p><wc></p>
<h1>
</h1>
<p></wc></p>
<wc>
<span>
</span>
</wc>
Produces (correct):
<p><wc>
<span>
</span>
</wc></p>
<wc>
<invalid>
</invalid>
</wc>
Produces (correct):
<p><wc>
<invalid>
</invalid>
</wc></p>