anchor names from headers (Setext and atx)?

Michel Fortin michel.fortin at michelf.com
Mon Sep 24 14:43:46 EDT 2007


Le 2007-09-24 à 14:18, Milian Wolff a écrit :


>> The correct way to write an anchor (so that it can be read by HTML

>> parsers) is to close it with an explicit closing tag:

>>

>> <a name="anchor-name"></a>

>

> Yes and no: Your markup is valid though it bloatens the markup by

> inserting an

> empty (thus meaningless) tag to the DOM Tree. Why not simply use

> the ID

> attribute on the correct item?


I guess I forgot to add the word "element" in the quoted sentence
above. I meant that the correct way to use the anchor *element* is to
close it with an explicit closing tag. I've never used it myself that
way (that I recall); I use the id attribute instead.

But it remains that ending an anchor with "/>" in an HTML-served
document is a common mistake and I wanted to point it out. (And to
point out a glitch on Daring Fireball.)


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




More information about the Markdown-Discuss mailing list