commonmark.js icon indicating copy to clipboard operation
commonmark.js copied to clipboard

Entities inside autolinks not recognized

Open xiaq opened this issue 3 years ago • 3 comments

https://spec.commonmark.org/0.30/#entity-and-numeric-character-references implies that only code spans and code blocks don't support entities.

However, the dingus doesn't support entities in autolinks either; the following

<http://&gt;>

is converted to

<p><a href="http://&amp;gt;">http://&amp;gt;</a></p>

(Dingus permalink: https://spec.commonmark.org/dingus/?text=%26gt%3B)

The & inside the autolink is recognized as a literal ampersand rather than the starter of an entity.

I'm inclined to think this is a bug of the dingus implementation but the dingus page itself doesn't say which implementation is behind it, so I'm filing it here. Please move it to the proper tracker if that is indeed the case.

xiaq avatar Oct 03 '22 14:10 xiaq

Yes, this is a bug in commonmark/commonmark.js

jgm avatar Oct 03 '22 15:10 jgm

cmark gives the correct output:

<p><a href="http://%3E">http://&gt;</a></p>

I'm transferring the issue; it's a bug in commonmark.js.

jgm avatar Oct 03 '22 15:10 jgm

Thanks, reworded the title to reflect that this is a bug.

xiaq avatar Oct 03 '22 16:10 xiaq