Markdown comments

Jelks Cabaniss jelks at jelks.nu
Mon Sep 18 12:58:47 EDT 2006


Daniel Lawson wrote:

>> The XML spec says:

>>

>> For compatibility, the string "--" (double-hyphen) must not

>> occur within comments.



> That stinks if you're trying to comment out any section of a web page

> that contains code using the decrement operator.


If you're talking about Javascript embedded in XHTML, those should not be
wrapped in comments, but in CDATA sections.

Wrapping scripts inside `<!-- -->` started mid nineties to "hide" scripts
from JS-unaware browsers. Even though there aren't any such beasts any
more, a number of people still blindly do it. But an XML parser will choke
on `--` inside comments, so it's probably best to get in the habit of using
CDATA sections for Javascript. (HTML Tidy will do this for you, by the
way.)


/Jelks



More information about the Markdown-Discuss mailing list