-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Marked does not handle links with parentheses #690
Comments
There's no way to get around this issue. Just replace closing parentheses with '%29' |
Why not? Out of curiosity, the StackOverflow inline editor, for example, fully supports this scenario. |
Because that would require regexes that count matching opening and closing brackets. And even that is not correct, because URLs are not guaranteed to have balanced brackets in the first place. |
Surely the balanced parentheses case is more common and would cover 99% of the cases here? |
Please consider that this behaviour would also break every existing link with escaped closing parens (and unescaped opening ones). |
@dend I got the same problem |
An option that accepts balanced parentheses matching would be nice. |
Summary: The markdown parser (Marked) used by the docs doesn't handle links ending with a closing bracket. The result is a broken link in the [Integration With Existing Apps](http://facebook.github.io/react-native/docs/integration-with-existing-apps.html#our-sample-app) guide. Using HTML makes the parser ignoring these links. Note: this is a well-known issue of Marked: markedjs/marked#690 Note bis: The fix #9429 didn't solve the problem. Closes #10225 Differential Revision: D3964341 fbshipit-source-id: 61564d1cbb632fa1f0c71e7c6cbdc0b9a200caa4
For reference, the CommonMark spec says that one level of balanced parentheses are allowed in link URLs without being escaped. If there are nested parentheses, or if they're unbalanced, they need to be escaped. I think this is doable with a regex, but I wouldn't want to be the one writing such a regex. |
Downstream, Jupyter notebooks and Jupyter lab are facing the same issue, e.g. with links to weird DOIs such as
GitHub renders it correctly: |
@ax3l: I’m not sure the example of GitHub doing it properly is actually doing so, I can see the number from the URL after the link text. Having said that, if it were rendering it probably, I would be curious to know if it’s the GitHub markdown processor doing it, or a post-process of some kind. We see the issue with Wikipedia URLs as well. Alternatively, one could also hardcode the HTML link, if the output destination is known. |
@joshbruce The GitHub you see is rendered improperly? This is what I see: I guess it's a tricky regex that balances the brackets. Interestingly, the downstream Jupyter |
This seems to be the regex used in pygments, maybe it helps: |
@ax3l: It's what I see now, but wasn't what I was seeing. First time I saw:
So, we'll see what we can do. We're focusing on hitting the CommonMark and GFM specs right now; so, not sure when this will become a priority, if it does. Just to keep you aware of where we are. |
This is a carbon copy of this bug for VSCode.
Here is an example where the preview engine in VSCode mis-renders links with parentheses:
Looks like a Marked issue - any way to fix it?
The text was updated successfully, but these errors were encountered: