An idea for within document anchor references

Fletcher T. Penney fletcher at alumni.duke.edu
Sat Aug 20 22:31:57 EDT 2005


John et al,

When I was playing around with my own version of Markdown, and
using it for my wiki, I realized that I really wanted to be able to
create anchors to headers within a file.

My solution to that was to modify the header output so that each
header is attached to an id tag:

<h3 id="someheadertext">Some Header Text</h3>

The header tag is simply the concatenated form of the header,
with invalid punctuation characters removed (keeping it valid XHTML).

To reference a given header, simply use the header as the id tag
for a reference style link (either implicit or not):

Link to [Some Header Text][].

If you already used that text to define a link, that is used
instead.


What do you (and others) think about this? I really like being able
to include within document references in the markdown document
itself, without hand-coding it in html.

I realize that this could cause problems when displaying multiple
markdown documents on a single page that share header titles (in a
weblog, for instance), and I suppose that a similar solution could be
employed as whatever is decided on things like footnotes.



Fletcher

--
Fletcher T. Penney
fletcher at alumni.duke.edu

After I'm dead, I'd rather have people ask why I have no monument than
why I have one.
- Marcus Porcius Cato


-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3949 bytes
Desc: not available
Url : http://six.pairlist.net/pipermail/markdown-discuss/attachments/20050820/0c83b823/smime.bin


More information about the Markdown-Discuss mailing list