marked
marked copied to clipboard
URLs wrapped in quotes include closing quote
Describe the bug With GFM enabled, URLs wrapped in quotes are linked, but the closing quote is also included in the final output (Lexer output to be precise)
To Reproduce
Expected behavior The closing quote should not be part of URL as well as linking text.
Here's another test case for this issue which I encountered in Sourcegraph's UI (uses marked to render error messages)
- Marked Demo (URL is enclosed by escaped quotes eg.
\"http://localhost:3434/v1/list-repos\") - Screenshot from Sourcegraph

If the URL is in square brackets and GFM is enabled, then the right square bracket is also part of the generated link. Could this be the same problem?
Example: [http://example.org]
Demo
@dru1 it looks like that isn't a valid link in GFM anyway
example: [http://example.com] [http://example.org]
You need angle brackets to make it a link
example: [<http://example.org>] [http://example.org]
@UziTech Thanks, this might help in my case. Just for clarification: I wonder, if [http://example.com] is not a valid GFM link, why does marked.js display this as a link at all? Shouldn't it just be text?
Yes that is a bug in marked. Unfortunately GFM extensions are very poorly documented so there are a lot of those edge cases that are not defined in the spec.