inline link syntax question

John MacFarlane jgm at berkeley.edu
Wed Sep 12 18:53:11 EDT 2012


I don't believe this question has been discussed before on
this list: Should whitespace be allowed between the bracketed
and parenthesized parts of an inline link? For example,

[foo] (/url)

The markdown syntax documentation says explicitly that a
space is allowed between the two parts of a *reference-style* link:


> Reference-style links use a second set of square brackets, inside which

> you place a label of your choosing to identify the link:



> This is [an example][id] reference-style link.

>

> You can optionally use a space to separate the sets of brackets:

>

> This is [an example] [id] reference-style link.


It does not make the same claim about inline links. All it says
is:


> To create an inline link, use a set of regular parentheses immediately

> after the link text’s closing square bracket.


"Immediately after" is most naturally interpreted as ruling out
whitespace. (Note also that this passage comes before the passage
quoted above.) This interpretation is confirmed by Markdown.pl,
which allows

[foo] [id]

as a reference-style link, but does not treat

[foo] (/url)

as an inline link.

Anyway, this was the reasoning the led me to disallow a space between
the two components of an inline link in pandoc. To me it would be more
natural to allow a space either in both kinds of links, but I tried to
stick to the spec. I note, though, that some implementations do allow a
space.

I'm curious whether those who do allow the space have any justification
for going against the natural interpretation of the spec here (and
against Markdown.pl), or whether this is just an oversight. I think
it would be good if implementations did not diverge on this.

John

PS. My own peg-markdown does allow the space. I think I'd just
forgotten that the spec treats inline and reference-style links
differently in this respect.

PPS. This query was prompted by a bug report against pandoc.
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=687453



More information about the Markdown-Discuss mailing list