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 wrapped in quotes include closing quote #1716

Closed
sidvishnoi opened this issue Jun 30, 2020 · 6 comments · Fixed by #2673
Closed

URLs wrapped in quotes include closing quote #1716

sidvishnoi opened this issue Jun 30, 2020 · 6 comments · Fixed by #2673
Labels
category: links L2 - annoying Similar to L1 - broken but there is a known workaround available for the issue

Comments

@sidvishnoi
Copy link

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

  1. Marked Demo

Expected behavior
The closing quote should not be part of URL as well as linking text.

@UziTech UziTech added category: links L2 - annoying Similar to L1 - broken but there is a known workaround available for the issue labels Jul 1, 2020
@UziTech
Copy link
Member

UziTech commented Jul 1, 2020

A workaround would be to use angle brackets around the url

text "<http://example.com>" text

demo

@tohjustin
Copy link

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
    Sourcegraph - URLs wrapped in quotes include closing quote

@dru1
Copy link

dru1 commented Feb 22, 2022

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

@UziTech
Copy link
Member

UziTech commented Feb 22, 2022

@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]

@dru1
Copy link

dru1 commented Feb 23, 2022

@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?

@UziTech
Copy link
Member

UziTech commented Feb 23, 2022

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.

dbojan added a commit to dbojan/handbook that referenced this issue Sep 16, 2023
problem:
In browser last quotes are part of the link. Tested in firefox, vivaldi
clicking on link does nothing.

solution:
Remove quotes:

URL location: 
https://jitsi.github.io/handbook/docs/user-guide/user-guide-start-a-jitsi-meeting

More info about github markdown bug here:
URLs wrapped in quotes include closing quote #1716 
markedjs/marked#1716
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: links L2 - annoying Similar to L1 - broken but there is a known workaround available for the issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants