Markdown comments

John Gruber gruber at
Sun Sep 17 19:30:22 EDT 2006

Michel Fortin <michel.fortin at> wrote on 9/16/06 at 5:23 PM:

> * Changed the parsing of HTML comments to match simply from

> `<!--` to `-->` instead using of the more complicated

> SGML-style rule with paired `--`. This is how most browsers

> parse comments and how XML defines them too.

Interesting. I had no idea that SGML comment rules were being
officially or semi-officially abandoned for HTML parsers. I
certainly welcome this change.

This page, and the included tests, seems like a good resource:


Test 4 is interesting:


The test is of this:

<!-- -- -->bar<!-- -- -->

SGML-compliant browsers will treat that not as two comments with
"bar" in middle, but instead as a comment tag containing three
different comments:

-- --
-- --

Safari 2.0.4 (419.3) treats it the simple (obvious) way, as two
comments with "bar" in the middle.

OmniWeb 5.5 treats it the SGML way. (I hate the way OmniWeb
overrides WebKit in so many edge cases, but that's another story.)

Firefox and Camino 1.0.1 treat it the SGML way.

I also downloaded a nightly build of Firefox, and it still treats
it the SGML way.

Opera 9.0 treats it the simple, obvious way.

* * *

I'd like to make this change to Markdown, because I genuinely
believe HTML comments *should* follow the simple, obvious rule,
not the SGML rules.

But I'd feel better about making this change in Markdown if Gecko
were on board.


More information about the Markdown-Discuss mailing list