[Link] shortcut

John Gruber gruber at fedora.net
Mon Mar 21 12:17:44 EST 2005


I've enabled using just [this] as a synonym for [this][] for the
next beta of Markdown. Not available for download yet, but you can
try it on the web dingus:

   <http://daringfireball.net/projects/markdown/dingus>

What's nice about this is that it's much easier on the eyes than
`[this][]`; those extra brackets are visually noisy.

Here's a problem that's occurred to me, however. If you have adjacent links like this:

    Check out [this] [that] and [the other].
    
    [this]: /this/
    
    [that]: /that/
    
    [the other]: /theother/

You're going to get unexpected output:

    <p>Check out <a href="/that/">this</a> and <a href="/theother/">the 
    other</a>.</p>

In other words, Markdown is going to treat `[this] [that]` as "this"
being the link text, and "that" being the link reference ID. Whereas
if you wrote:

    Check out [this][] [that][] and [the other][].

"this" and "that" are treated as separate links.

It has to be this way, because the existing style of links need to
be processed before this new no-extra-brackets shortcut style.

I don't think this problem is bad enough to warrant not supporting
the shortcut syntax; it's just something you'll have to be aware of
if you use it. If you don't want to worry about it, you can just use
the existing link syntax.

* * *

If I had it to do all over again, I think what I would do is only
use `*` for emphasis. Then I could use `_` for link shortcuts:

        Check out [this]_ [that]_ and [the other]_.

The idea being that `_` feels linky because it's an underscore, and
links are traditionally underscored on web pages.

But it's too late for that.

-J.G.


More information about the Markdown-Discuss mailing list