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? Thanks, Jeremy C. Reed
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
Pandoc generates <h2 id="this-is-an-h2">This is an H2</h2> For the details, see http://johnmacfarlane.net/pandoc/README.html#header-identifiers-in-html John +++ Jeremy C. Reed [Sep 22 07 13:22 ]:> 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? > > Thanks, > > Jeremy C. Reed > _______________________________________________ > Markdown-Discuss mailing list > Markdown-Discuss at six.pairlist.net > http://six.pairlist.net/mailman/listinfo/markdown-discuss >
Le 2007-09-22 ? 14:22, Jeremy C. Reed a ?crit :> <a name="This is an H2"/>Be careful with that. The `/>` terminator is only recognised by browsers when using the XML parser, which is to say when you send your document with an XML mime type (text/xml, application/xml, application/xhtml+xml). For the HTML parser (text/html), the markup above will be an unclosed anchor tag, and will span until the next opening anchor tag unless a corresponding closing tag (`</a>`) is found. If your anchor is not a link, there will be few side effects beside a strange DOM tree inside the browser. That's unless you have some CSS rule defined for tag "a". For an example of this: go to the [Markdown project page][1] on Daring Fireball, move your mouse pointer over the first words in the paragraphs following the "Discussion List" and "Installation and Requirements" headers and you'll see some unexpected rollover effects. [1]: http://daringfireball.net/projects/markdown/ 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> Michel Fortin michel.fortin at michelf.com http://michelf.com/
And just to round out the "me too's" in this thread, MultiMarkdown has this feature as well. (And, via an XSLT file, you can generate a ToC in XHTML). Fletcher On Sep 22, 2007, at 2:22 PM, Jeremy C. Reed wrote:> 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? > > Thanks, > > Jeremy C. Reed > _______________________________________________ > Markdown-Discuss mailing list > Markdown-Discuss at six.pairlist.net > http://six.pairlist.net/mailman/listinfo/markdown-discuss-- Fletcher T. Penney fletcher at fletcherpenney.net I put contact lenses in my dog's eyes. They had little pictures of cats on them. Then I took one out and he ran around in circles. - Steven Wright -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2437 bytes Desc: not available Url : <http://six.pairlist.net/pipermail/markdown-discuss/attachments/20070924/25479a35/attachment.bin>