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
I think a space *should* be allowed. Some text editors seem to wrap between those characters, IIRC, which leads to problems if a space is not allowed. Short of convincing argument to the contrary, I plan on keeping the optional space between the two in MultiMarkdown. So, for selfish reasons, I would love it if you keep it in peg-markdown so I don't have to revert the change. :) Fletcher Sent from my iPad On Sep 12, 2012, at 5:53 PM, John MacFarlane <jgm at berkeley.edu> wrote:> 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 > > _______________________________________________ > Markdown-Discuss mailing list > Markdown-Discuss at six.pairlist.net > http://six.pairlist.net/mailman/listinfo/markdown-discuss-------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 4840 bytes Desc: not available Url : <http://six.pairlist.net/pipermail/markdown-discuss/attachments/20120912/89db91d9/attachment.bin>
On Wed, Sep 12, 2012 at 6:53 PM, John MacFarlane <jgm at berkeley.edu> wrote:> 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?I seem to recall authoring a few documents in which I expected some text in parentheses following a shortened reference style link (no second set of brackets) to trigger a inline link. However, the space saved me. Sure I could have used two spaces, but I shouldn't have to. Personally, its unclear to me why JG would have explicitly allowed the space in reference style links. What useful purpose does it serve? BTW, the shortened reference style links are not documented anywhere, but clearly work in the latest version of markdown.pl. Here's an example source paragraph: Some text with a [link] (and some text in parentheses). [link]: http://example.com That should result in: <p>Some text with a <a href="http://example.com">link</a> (and some text in parentheses).</p> As it does in markdown.pl and others. However, if the space is allowed in inline links, then you get the incorrect output: <p>Some text with a <a href="and some text in parentheses">link</a>.</p> In contrast, I can't think of any situation in normal text where a double set of brackets would appear except as a reference link. Therefore a space is not harmful. Perhaps that is why JG allowed it there. I guess this is the long way of me saying Pandoc should stay the way it is (which also means I get to leave Python-Markdown alone). In fact, if I was going to suggest any change (for consistency) I would say that we should disallow the space in reference style links. But given the current wording of the syntax rules, I can't really see that happening either. PS: I like to use parentheses in my sentences (as you can see above - and right here). I suppose others do not. For those people, this wouldn't really matter so much. It does matter to those of us who use them thought. -- ---- \X/ /-\ `/ |_ /-\ |\| Waylan Limberg