Skip to content

Inconsistent escape of image alt #264

Open
@xiaq

Description

@xiaq

An obscure edge case, but still...

< is usually escaped in image alt:

![a <](b.png)

becomes

<p><img src="b.png" alt="a &lt;" /></p>

(https://spec.commonmark.org/dingus/?text=!%5Ba%20%3C%5D(b.png))

However, if the < is part of an HTML tag, it is not escaped in the output:

![a <a>](b.png)

becomes

<p><img src="b.png" alt="a <a>" /></p>

(https://spec.commonmark.org/dingus/?text=!%5Ba%20%3Ca%3E%5D(b.png))

cmark generates the expected output:

<p><img src="b.png" alt="a &lt;a&gt;" /></p>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions