Problem with links in Markdown

Alexander Veit lbloom at
Thu Jun 20 14:48:45 EDT 2013


recently I stumbled over a problem with the Markdown link syntax[1]

This is [an example]( "Title") inline link.

RFC 2396[2], section 2.3 defines left and right parentheses to be mark characters, and thus unreserved characters in URIs. This means that left and right parentheses do not need to be percent encoded in URIs.

>From this definition it follows that the above inline link syntax cannot be parsed correctly in all cases. This can e.g. be shown with the online converter at Daring Fireball[3] and the source

The book of [Life]( "Life textbook").

which is converted to

<p>The book of <a href="">Life</a> "Life textbook").</p>

However, there's probably a solution to this problem. RFC 2396, 2.4.3 defines the left and right angle brackets as delimiters and explains that

> The angle-bracket "<" and ">" and double-quote (") characters are

> excluded because they are often used as the delimiters around URI in

> text documents and protocol fields.

This means that left and right angle brackets will never occur as part of an URI. So deprecating parentheses, and replacing the parentheses with angle brackets in Markdown's inline link syntax would resolve the problem described. As an additional benefit, this would unify Markdown inline link syntax and reference-style link syntax, and simplify link parsing.

Any thoughts on this?

Alexander Veit

[1]: <>
[2]: <>
[3]: <> (Markdown 1.0.2b7)

More information about the Markdown-Discuss mailing list