Orc/discount

Links with right parenthesis rendering are broken

Closed this issue · 5 comments

Wikipedia is using right parenthesis in urls and this in turn then breaks the link when rendered with discount.

$ cat foo.bar 
[wikipedia](https://en.wikipedia.org/wiki/Peter_Eckersley_(computer_scientist))
$ markdown foo.bar 
<p><a href="https://en.wikipedia.org/wiki/Peter_Eckersley_(computer_scientist">wikipedia</a>)</p>
Orc commented

That's how it's supposed to work: the daringfireball dingus renders it in exactly the same way.

You need to either escape the inner ) (use [wikipedia](https://en.wikipedia.org/wiki/Peter_Eckersley_(computer_scientist\))) or use a footnote referral for it.

Markdown knows nothing about the inner structure of a url, so it can't intuit whether a (...(...)) is structured or if it's a link to (...(...

Ah I see but arguable that's probably the wrong thing to do and most people implement now CommonMark which does the right thing https://spec.commonmark.org/dingus/

I don't see in the written specs that it needs to be implemented in this way and i didn't see a test for that,
because of that I would argue that this could be fixed in a way which is more intuitive for the user.
(But tbh I get if there is no interest to do that)

Side note then at least -G does the wrong thing (or is at least misleading) since GitHub renders this correctly
As the gfm spec contains this:

This formal specification is based on the CommonMark Spec by John MacFarlane

https://github.github.com/gfm/

Orc commented

That's the problem, then; github flavo(u)red markdown used to be markdown with extensions, but since I added the patches to handle eoln-makes-a-break it switched over to commonmark, which I'm sure is a perfectly cromulent markup language but it isn't markdown.

I want to remain compatible with actual markdown, which means I need to follow its behavior.

¯\_(ツ)_/¯

fair enough

Orc commented

Oh, and also a url can be quoted with <...> to have it not catch any closing )s inside it. Like wikipedia