md4c icon indicating copy to clipboard operation
md4c copied to clipboard

invalid HTML involving tilde and link notation

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

I stumbled on a case involving strikethrough and link notation whereby md2html produces invalid HTML, because of an unbalanced <del> tag. The intention of all the examples below is not to trigger strikethrough, but you can see that <del> sneaks in regardless.


md2html --fstrikethrough << EOF
a ~ b [](#a%20~%20b)

a ~~ b [](#a%20~~%20b)

a ~ b [](#a%20~~%20b) GOOD

a ~ b [](#a%20~/%20b) punctuation matters

~ [](~) length likely doesn't matter

~ [](<~>) angular brackets don't help

[~][~] link references don't help
EOF

Output (md2html 0.5.2):

<p>a <del> b <a href="#a%20~%20b"></a></p>
<p>a <del> b <a href="#a%20~~%20b"></a></p>
<p>a ~ b <a href="#a%20~~%20b"></a> GOOD</p>
<p>a <del> b <a href="#a%20~/%20b"></a> punctuation matters</p>
<p><del> <a href="~"></a> length likely doesn't matter</p>
<p><del> <a href="~"></a> angular brackets don't help</p>
<p>[<del>][</del>] link references don't help</p>

step- avatar Dec 01 '24 08:12 step-