Contents of HTML preformatted text blocks (<pre>…</pre>) are, correctly, left alone:
e.g.,
is rendered correctly as, with the contents untouched:
However, if you wrap that in a <div>:
<div>
<pre>a
b
</pre>
</div>
the commonmark parser starts parsing the contents of the <pre> tag following the empty line, which corrupts the resulting HTML:
<div>
<pre>a
<p>b
</pre></p>
</div>
Notice the erroneously added <p> tag prior to b that closes following the </pre> tag.
I encountered this in Markdown-it and was able to narrow it down to this test case which is also reproducible in the commonmark parser at https://spec.commonmark.org/dingus/.
Related:
• markdown-it/markdown-it#238