M-dashes not allowed in XHTML comments

I found out today that one of my favorite punctuation marks—the m-dash—can’t be used in standard comments in an XHTML 1.0-strict document. To be correct, it’s actually the m-dash’s plain-text facsimile the double hyphen, that can’t be used. It goes without saying that the HTML special character equivalent: — isn’t very readable when it’s not rendered.

Why would anyone be using m-dashes in a code comment? Well, I do! I like to write notes to people viewing my pages’ source to explain certain things I’ve done. As a writer, I love the m-dash—it’s short and powerful. Validating my pages agains the W3C’s Markup Validation Service showed me that it’s not allowed because:

invalid comment declaration: found name start character outside comment but inside comment declaration.

So I went back to the less awesome but similar parenthesis for my comments. Oh well. Me and like two other people in the world care.

Leave a Reply