Display name
Display name

Reputation: 4481

How do you escape comments in markdown?

If I write <date> (without the ` back ticks) in markdown it disappears as markdown thinks I'm trying to write a comment. How can I make <date> appear in plain text, in markdown, without having to resort to back ticks? I tried escaping the < and > but that didn't help anything.

Upvotes: 3

Views: 3165

Answers (1)

Waylan
Waylan

Reputation: 42467

The Syntax Rules mention this specifically:

In HTML, there are two characters that demand special treatment: < and &. Left angle brackets are used to start tags; ampersands are used to denote HTML entities. If you want to use them as literal characters, you must escape them as entities, e.g. &lt;, and &amp;.

Therefore, you can do this:

&lt;date&gt;

which renders as

<date>

As an aside, I remember the names of these entities by the names of the symbols. The letters lt and gt are acronyms for "less than" and "greater than" respectively.

Upvotes: 8

Related Questions