Problem with links in Markdown

Alexander Veit lbloom at gmx.net
Sun Jun 23 15:36:54 EDT 2013


Michel Fortin wrote:


> -----Original Message-----

> From: markdown-discuss-bounces at six.pairlist.net [mailto:markdown-

> discuss-bounces at six.pairlist.net] On Behalf Of Michel Fortin

> Sent: Thursday, June 20, 2013 10:17 PM

> To: Discussion related to Markdown.

> Subject: Re: Problem with links in Markdown

>

> Le 20-juin-2013 à 14:48, Alexander Veit <lbloom at gmx.net> a écrit :

>

> > The book of [Life](https://en.wikipedia.org/wiki/Life_(textbook)

> "Life textbook").

> >

> > which is converted to

> >

> > <p>The book of <a

> href="https://en.wikipedia.org/wiki/Life_(textbook">Life</a> "Life

> textbook").</p>

>

> Most Markdown implementations out there do the right thing: matching

> opening and closing parenthesis. It's just sad that Markdown.pl

> doesn't.

> http://johnmacfarlane.net/babelmark2/?normalize=1&text=The+book+of+%5BL

> ife%5D(https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FLife_(textbook)+%22Life+

> textbook%22).%0A


OK, but matching opening and closing parens is nothing more than the attempt to make an educated guess. Even though the approach reduces the number of failures, it does not make a correct algorithm for parsing arbitrary links.



> [...]

>

> Angle brackets surrounding the URL are supported by most Markdown

> parsers, but the URL must be kept inside the parens.


OK, agreed. Even though additional parens are required, it seems to me that this is in better accordance with the reference-style link syntax.



> Unfortunately, only some parsers correctly use them

> to disambiguate:

> http://johnmacfarlane.net/babelmark2/?normalize=1&text=%5BBrackets%5D(%

> 3Chttps%3A%2F%2Fen.wikipedia.org%2Fwiki%2F)%3E+%22Brackets%22).%0A


Imho, these are bugs:

showdown 0.3.1
Markdown.pl 1.0.1
RDiscount 1.6.8
marked 0.2.6
RedCarpet 2.1.1:
Opening angle-bracket ignored, https://en.wikipedia.org/wiki/ rendered as a link.

Markdown.pl 1.0.2b8:
Invalid URI syntax in generated link.

peg-markdown 0.4.14
Maruku 0.6.1
Maruku (Math-Enabled) 0.7.1.beta1:
Non-URI character HTML-escaped, wrong link generated.


--
Just my two cents
Alex





More information about the Markdown-Discuss mailing list