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

HTML not being escaped at all!

Open davidearl opened this issue 8 years ago • 1 comments

Oh dear, this is a pretty fundamental lack of reading of the markdown spec or lack of understanding of html.

If you write this markdown[1]: wibble & wobble 4 < 5 it should translate as wibble &amp; wobble 4 &lt; 5 but it doesn't, so generates incorrect HTML.

If you're going to try to sort this using pattern matching, don't forget that the document might end with an ampersand or less-than. Given that, while less-than need not be escaped inside attribute values, it does no harm either, there may be a common pattern matching solution for general text and ampersand inside attributes (but not for double quotes inside attributes, I think).

[1] https://daringfireball.net/projects/markdown/syntax#autoescape

davidearl avatar Jun 23 '16 11:06 davidearl

The title was perhaps rather extreme, sorry. Changed to be more accurate.

davidearl avatar Jun 23 '16 17:06 davidearl