Markdown.pl: correct comment sanitation
commit003134a723a9166e8ea80efab4818ca97bdbc3f1
authorKyle J. McKay <mackyle@gmail.com>
Thu, 3 Sep 2020 05:56:32 +0000 (2 22:56 -0700)
committerKyle J. McKay <mackyle@gmail.com>
Thu, 3 Sep 2020 05:56:32 +0000 (2 22:56 -0700)
tree1b896f721b58e86da213cc4aa0f898e7e93893c4
parent6956d990d2773e8913b84d8aea1c291b59017a08
Markdown.pl: correct comment sanitation

The XML standard section 2.5 is quite specific:

  the string "--" (double-hyphen) MUST NOT occur within comments

In fact, xmllint will complain about any comments that
incorrectly contain an internal "--" sequence as they are
not valid XML.

Adjust the sanitation code to only pass through valid XML
comments using the same pattern that _HashHTMLBlocks uses
to recognize them.

With this change, invalid XML comments will be treated as
literal text by the sanitizer and have the initial "<" escaped
to &lt; thus rendering them as not a comment at all.

Also take this opportunity to correct the comments in the
_HashHTMLBlocks function from "HTML" to "XML" to reflect
what it actually matches.

Signed-off-by: Kyle J. McKay <mackyle@gmail.com>
Markdown.pl