You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Marked follows original mardown.pl behavior for this. Libupskirt/sundown also shares the same behavior.
If we're supposed to allow parentheses in urls, what happens when parentheses are incorrectly closed?
[foo](http://example.com/foo_)bar)
What should happen here? The only way to parse () is by keeping state and track of how many levels deep of nested parentheses you're in, but there are no rules for URLs. URLs might provide misnested parens, etc.
What about:
[foo](http://example.com/foo_(bar)
Should marked keep parsing the text after "bar)" since it hasn't seen a proper closing paren for the link syntax?
How about this:
[foo](http://example.com/foo_(((((((((bar))
Is marked even supposed to guess what is going on there by interpreting the parens in that url?
I feel like this change would only exist to accommodate wikipedia links, which can already either be encoded, or included as link references.
If someone can come up with a definite outline of what should happen in all these other cases, I'm all for it.
I got your point. Since you must have a line break, or a space after an url, or another url, or still you have reached the end of the document, you can simply consider the last parenthesis, like the parenthesis that closes the link.
[foo](http://example.com/foo_(bar)
In the above example, you should have the following link: http://example.com/foo_(bar. Using this approach every wikipedia link just works as is. You just consider the open and the close round brackets, ignoring all the others inside the link. I'm gonna post this bug in Hoedown too, Sundown is a dead project.
I got your point. Since you must have a line break, or a space after an url, or another url, or still you have reached the end of the document, you can simply consider the last parenthesis, like the parenthesis that closes the link.
That would break links at the end of a parenthetical, which is common enough to be concerning.
@scottgonzalez, I've told people that before. It doesn't seem very effective. This is probably the second issue on this. GFM does do it, and I think it's unintelligent, but I'll try it and see how it goes. Maybe it won't hurt performance much and I'll be okay with it despite disagreeing with it philosophically.
Encoding URLs is not an option :(
This is a show stopper for us, and I have the feeling this won't be fixed any time soon...
Guess it's time to switch library. What would be a good alternative?
Activity
chjj commentedon Apr 28, 2014
Marked follows original mardown.pl behavior for this. Libupskirt/sundown also shares the same behavior.
If we're supposed to allow parentheses in urls, what happens when parentheses are incorrectly closed?
What should happen here? The only way to parse
()is by keeping state and track of how many levels deep of nested parentheses you're in, but there are no rules for URLs. URLs might provide misnested parens, etc.What about:
Should marked keep parsing the text after "bar)" since it hasn't seen a proper closing paren for the link syntax?
How about this:
Is marked even supposed to guess what is going on there by interpreting the parens in that url?
I feel like this change would only exist to accommodate wikipedia links, which can already either be encoded, or included as link references.
If someone can come up with a definite outline of what should happen in all these other cases, I'm all for it.
dedalozzo commentedon Apr 28, 2014
I got your point. Since you must have a line break, or a space after an url, or another url, or still you have reached the end of the document, you can simply consider the last parenthesis, like the parenthesis that closes the link.
In the above example, you should have the following link:
http://example.com/foo_(bar. Using this approach every wikipedia link just works as is. You just consider the open and the close round brackets, ignoring all the others inside the link. I'm gonna post this bug in Hoedown too, Sundown is a dead project.JCMais commentedon Apr 28, 2014
I just saw this while reading the source code from hoedown, https://github.com/hoedown/hoedown/blob/master/src/autolink.c#L102
It's from the autolink feature, but somewhat related, isn't?
dedalozzo commentedon Apr 28, 2014
I have just known that the bug was fixed in Hoedown long time ago. Yeah, I suppose you right.
scottgonzalez commentedon May 5, 2014
That would break links at the end of a parenthetical, which is common enough to be concerning.
Ernest0x commentedon May 15, 2014
Perhaps you could also support using double quotes inside the parenthesis and take everything inside the quotes as the url:
scottgonzalez commentedon May 15, 2014
@chjj I think it's time to close this and just tell people to manually encode the URLs using
%29instead of).scottgonzalez commentedon May 15, 2014
Actually, you'll need to implement paren matching logic for GFM. It looks like GitHub always requires paired parens inside a URL.
chjj commentedon May 15, 2014
@scottgonzalez, I've told people that before. It doesn't seem very effective. This is probably the second issue on this. GFM does do it, and I think it's unintelligent, but I'll try it and see how it goes. Maybe it won't hurt performance much and I'll be okay with it despite disagreeing with it philosophically.
dedalozzo commentedon May 15, 2014
You can't ask people to encode urls, because they simply copy and paste urls from the address bar of a browser. :-(
-Filippo
On May 15, 2014, at 2:19 PM, Scott González wrote:
sn3p commentedon Feb 29, 2016
Encoding URLs is not an option :(
This is a show stopper for us, and I have the feeling this won't be fixed any time soon...
Guess it's time to switch library. What would be a good alternative?
dedalozzo commentedon Feb 29, 2016
I'm using Hoedown, a PHP extension to the Hoedown library.
joshbruce commentedon Dec 25, 2017
#984