A reminder of the original design goal of Markdown - my personal thoughts

Damian Cugley damian.cugley at gmail.com
Tue Sep 6 05:22:59 EDT 2005


On 9/5/05, John Gruber <gruber at fedora.net> wrote:


> Having more than one same-level heading with the same text is not

> complicated. The problem with automatic id generation is that id

> attributes must be unique. What happens if you have input like this:

>

> # GoodFellas

> ## Rating

> 5 stars

>

> # Mean Streets

> ## Rating

> 4 stars

>


Perhaps this has already been suggested, but you *could* have Markdown
generate ids that include the ids of enclosing sections:

<h2 id="goodfellas">Good Fellas</h2>
<h3 id="goodfellas_rating">Rating</h3>
...


> And it's not just for headers within the same article. What happens if

> the above are two different posts but which are shown on the same index

> page of a weblog. The headers still need to be unique.


When combining articles in to an index page, your software must munge
the HTML to change the internal links and anchors. My website builder
already does something like this, because the same input file might
appear at <http://www.alleged.org.uk/pdc/> and
<http://www.alleged.org.uk/pdc/2005/08/06.html>, which means that
relative URIs to images and other pages need to be munged so as to
still make sense. (Not that I am holding my site up as an example of
perfection.)

Having said all that, I also like the idea of having the `{#xxx}`
notation available as an escape valve. I don't think it looks too out
of place even when considering the Markdown document as plain text.
You could always throw in a few TABs to push it in to the right-hand
margin where human readers can ignore it. I've seen plain-text
documents that use similar conventions.

Not sure of the best approach to non-ASCII characters when generating
IDs; my latin-script-centric suggestion would be transliteration
(τίτλος becomes #titlos), but that requires Unicode savvy in the
processor way beyond regular expressions. If Markdown processes
internal references the same way it does headings, the details of the
gibberish produced may be invisible to the author:

# Καλοί συνεργάτες
## Εκτίμηση

...more text... [...link text...](#Καλοί συνεργάτες_Εκτίμηση)

where Markdown guarantees to turn that in to something
XHTML-compatible, without specifying exactly what. Please excuse my
Greek gibberish; it comes straight out of Babelfish.


-- Damian

--
Damian Cugley, Alleged Literature
http://www.alleged.org.uk/pdc/


More information about the Markdown-Discuss mailing list