md4c icon indicating copy to clipboard operation
md4c copied to clipboard

md2html and cmark differ on ATX headings

Open step- opened this issue 1 year ago • 0 comments

Given the following Markdown involving four headings, md2html's and cmark's results diverged on the third and fourth headings.

Mardown:

# _h _

# _h _[](<#_h%20_>)

# _h _[](<#h-_>)

# _h _[](<#h__>)

md2html 0.5.2 output (Linux):

<h1>_h _</h1>
<h1>_h _<a href="#_h%20_"></a></h1>
<h1>_h <em><a href="#h-_"></a></h1>
<h1><em>h <em><a href="#h__"></a></h1>

cmark 0.31.1 output:

<h1>_h _</h1>
<h1>_h _<a href="#_h%20_"></a></h1>
<h1>_h _<a href="#h-_"></a></h1>
<h1>_h _<a href="#h__"></a></h1>

On a side note: in the third tag md2html opened an <em> tag without closing it. I guess that's expected since MD4C doesn't validate by design.

step- avatar Jan 16 '25 15:01 step-