Skip to content

invalid HTML involving underscore/asterisk and link notation #277

@step-

Description

@step-

Similar to #276 I found a case involving underscore, asterisk and link notation whereby
md2html produces invalid HTML, because of an unbalanced <em> tag.
The intention of all the examples below is not to trigger emphasis, but
you can see that <em> sneaks in regardless.

Note that replacing * for _ in all the examples below produces the same invalid output.


With underscores only:

md2html --fstrikethrough << EOF
a_[](#a%20_) good

a__[](#a%20__) good

a_[](#a%20__) good

a_[](#a%20_/) good, punctuation doesn't matter

_[](_) unbalanced EM

_[](<_>) unbalanced EM

[_][_] balanced but unwanted EMs
EOF

Output (md2html 0.5.2):

<p>a_<a href="#a%20_"></a> good</p>
<p>a__<a href="#a%20__"></a> good</p>
<p>a_<a href="#a%20__"></a> good</p>
<p>a_<a href="#a%20_/"></a> good, punctuation doesn't matter</p>
<p><em><a href="_"></a> unbalanced EM</p>
<p><em><a href="_"></a> unbalanced EM</p>
<p>[<em>][</em>] balanced but unwanted EMs</p>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions