anchor names from headers (Setext and atx)?

Milian Wolff mail at milianw.de
Sat Sep 22 14:43:13 EDT 2007


Am Samstag, 22. September 2007 schrieb Jeremy C. Reed:

> It would be useful if defining headers (either Setext and atx style), if

> Markdown would also generate corresponding anchors:

>

> ## This is an H2 ##

>

> would create:

>

> <a name="This is an H2"/>

> <h2>This is an H2</h2>

>

> Or something like that.

>

> Or is that available some different way?


In PHP Markdown Extra there is:

## This is an H2 {#myid}

Also note that your markup is not very good, you should use something like
that:

<h2 id="This_is_an_H2">This is an H2</h2>

But custom ID's (see above) is far better imo.

--
Milian Wolff
http://milianw.de


More information about the Markdown-Discuss mailing list