Open kevinburke opened 7 years ago
Here is at least one specification documenting the correct treatment of entity references: http://spec.commonmark.org/0.28/#example-302
When I run their reference program on this source code:
<pre>quote: "</pre>
I get
<pre>quote: "</pre>
Running the same file through either v2
or v2-commonmark-testsuite
yields the following results:
<p><pre>quote: &quot;</pre></p>
Let's say I have the following Markdown document:
"
is a valid html entity number for a double quotation mark. Notably, it is the output produced by Go'shtml.EscapeString(
function."
)If I run it through blackfriday, the ampersand is escaped again, yielding:
It seems that blackfriday is escaping an ampersand that is part of a valid entity sequence. The equivalent would be if blackfriday turned
&
into&amp;
(it does not do this).The following sample program can demonstrate the problem. I encountered this in real code when trying to render code blocks using github.com/alecthomas/chroma, and then compiling entire markdown documents using blackfriday.
Here's the Go source and rationale:
https://www.w3schools.com/html/html_entities.asp