Links with parenthesis end link generation prematurely
kamranayub opened this issue · 3 comments
I'm using Octopress with RDiscount for the MD generator.
Given this piece of Markdown:
[test](http://www.asp.net/web-api/overview/security/preventing-cross-site-request-forgery-(csrf)-attacks)
The link does not generate properly, it ends after the inner last parenthesis:
Looks like the Regex/parsing needs to account for inner parenthesis in links.
There isn't a good way to unambiguously detect whether a ) is a close paren in the link or a close paren that ends the link block. Thus it's probably best to entity-escape the parens in the link:
Try replacing ( with %28 and ) with %29.
Yah, makes sense, since there could easily be spaces in the URL as well. I was using MarkdownSharp previously (C# Markdown parser) and it handled it, but not sure how they determine where to stop.
Closing this, as there's no obvious way to handle embedded parens in links unambiguously.