Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

URLs with parentheses are not converting properly. #619

Closed
Pomax opened this issue Jul 14, 2015 · 5 comments · Fixed by #1135
Closed

URLs with parentheses are not converting properly. #619

Pomax opened this issue Jul 14, 2015 · 5 comments · Fixed by #1135

Comments

@Pomax
Copy link

Pomax commented Jul 14, 2015

Using the following markup:

[青 ("ao")](https://en.wikipedia.org/wiki/Ao_(color))

leads to a link that actually looks like 青 ("ao")) with the link's own parenthesis getting cut off (marked seems to be treating the first ) it sees as link terminator, instead of taking nesting into account)

@rgbkrk
Copy link

rgbkrk commented Jul 15, 2015

Definitely an issue, that I see happening across the web from users of marked.

@bendecoste
Copy link

Is there an ETA for a fix on this ?

@Pomax
Copy link
Author

Pomax commented Jul 23, 2015

I have no expectation that @chjj will ever fix this, but it's mostly a bug that stems from a bad assumption in https://github.com/chjj/marked/blob/master/lib/marked.js#L467, which is terminal: unless someone introduces a "respect nesting" operator to JavaScript's RegEx engine, it is impossible to user regular expressions in a way that properly deals with blocks/nesting.

(which is why we typically don't parse structure syntax with regex, but with tokenizers instead)

I was thinking of trying to fix this, but "fix" in this case means "write a new parser that doesn't rely on regex", and that's not happening. So: if you need links in which the URI contains (), don't use marked.js

@Pomax
Copy link
Author

Pomax commented Jul 23, 2015

filed #630 as PR to at least make it explicit that this is a pure RegEx parser, with all the limitations that brings with it.

@joshbruce
Copy link
Member

#984

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants