Escaping "<"

Michel Fortin michel.fortin at michelf.com
Tue Mar 15 19:12:13 EST 2005


Le 15 mars 2005, à 18:48, Jelks Cabaniss a écrit :

> Michel Fortin wrote:
>
>> By the way, it may be needed for ampersands too, think of this:
>>
>> 	He works for AT&T; he has a nice job.
>>
>> Markdown thinks `&T;` is an entity.
>
> ???
>
> Markdown currently allows AT&T with no escaping of the ampersand -- it 
> knows the difference between a non-entity like `&T` on one hand and 
> `&copy;`, `&ouml;`, etc. on the other.  The AT&T example is even on 
> the syntax page, or maybe I'm misunderstanding what you're saying.

Have you noticed there is a semicolon just after "AT&T" in that 
example? This is a very narrow case where a semicolon follows a word 
that contains an ampersand, in which case the text between `&` and `;` 
is thought to be an entity name. Markdown has not hard-coded list of 
every existing entity to check that `&T;` is not a valid one, so if it 
looks like an entity it will treat it like it is.

Try my example in the dingus: it won't properly change `&` into 
`&amp;`. Here's the result:

	<p>He works for AT&T; he has a nice job.</p>


Michel Fortin
michel.fortin at michelf.com
http://www.michelf.com/


More information about the Markdown-Discuss mailing list