Escaping "<"

Jelks Cabaniss jelks at jelks.nu
Thu Mar 17 17:35:24 EST 2005


Joseph Lorenzo Hall wrote:
> Sorry to be such a n00b, but... is there a reason that MD doesn't
> replace the corresponding `>` with `&gt;`? 

Of the five XML "built-in" entities, only `&` and `<` *must* be escaped in
parsed character data (i.e., "normal text").  `&quot;`, `&apos;`, and `&gt;`
do not have to be; they are mainly provided so you use them in attribute
values, as in:

	<p title="The &quot;meaning&quot; of life">...

(How else could you get a quote inside a quoted attribute value?)

But in parsed character data, you don't have to write

	<p>The "meaning" of life is ...

as

	<p>The &quot;meaning&quot; of life is ...

(although you *could* if you wanted, and a number of older -- and even a few
current -- HTML editors misguidedly seem to think that they *must*).

Same goes for `>`.


/Jelks



More information about the Markdown-Discuss mailing list