Extending markdown?

John Gruber gruber at fedora.net
Wed Jul 27 11:07:00 EDT 2005


MDK <michaldominik at gmail.com> wrote on 07/23/05 at 1:34 pm:


> 1. Image linking. It often happens, that you post a thumbnail image

> being a link to the full-size image (think: photos, screenshots...). It

> would be nice to extend the ![]() to support an image being a link to

> something. Say: ![alt text](img src){link address}


I agree that it is difficult to include an image that is a link, but
throwing {} into the mix doesn't fix it.



> 2. Linking to headers. It would be cool to be able to easily link to

> headers in the created document. So that we don't have to use the...

>

> <h3 id="philosophy">Philosophy</h3>

>

> ....thing. If I have a

>

> ## Philosophy ##

>

> in my document, writing a

>

> [click here][Philosophy]

>

> should create a link to the Philosophy header.


But creating unique IDs for these headers automatically is not easy. What happens if you have two or more h2 headers that use the same text:

# Section 1

Blah

## Notes


# Section 2

Blah blah blah.

## Notes

How do you assign unique IDs to both h2 "Notes"? And how do you know
which one you're linking to when you link to:

[Click here][Notes]

or:

[Notes][]

The answer is that you can't. You're asking Markdown to do too much
automatically. I'm aware of this problem, and I'll address it
eventually, but you will have to assign some sort of ID manually to
the headers you want to link to internally. It'll be better than
resorting to inline HTML, but it can't be as automatic as you're
proposing.



> 3. Aligning. You might not agree on this one - I think that if

> something is really tabbed-away from the left margin (say: 12 spaces, 3

> tabs) it should get right-aligned automatically. This might break the

> current syntax semantics so I suppose this is not so important.


No way.

If you want to specify alignment, you'll have to assign a class to
the paragraph. [^1] Or to a parent div:

<div markdown='1' style='text-align: right;'>

Right-aligned paragraphs here.

</div>

-J.G.


[^1]: Search the list archives for some of my syntax ideas for how
you might be able to assign classes to paragraphs and other
block elements.


More information about the Markdown-Discuss mailing list