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

gfm mode underscore in link url starts emphasis #4079

Open
shark404 opened this issue Jun 21, 2016 · 3 comments
Open

gfm mode underscore in link url starts emphasis #4079

shark404 opened this issue Jun 21, 2016 · 3 comments

Comments

@shark404
Copy link

Reproducible here: http://codemirror.net/mode/gfm/index.html

While using the gfm mode if there is an underscore in the url get parameters this triggers the start of an emphasis block. So if you have an inline link with an underscore the text following is emphasised.

Here is a link, https://test.com?_test and this text is in italics

image

I would expect the underscore within the link to be ignored for formatting.

I took a look at the code but seems like it may be a non-trivial fix as the underscore logic is in the markdown mode where as this "autolink" logic is in the gfm mode. Is it as simple as setting state.linkHref in the gfm link logic? https://github.com/codemirror/CodeMirror/blob/master/mode/gfm/gfm.js#L106

Is the state shared between modes? Sorry this is the first time at looking at how CodeMirror works so I don't have a clear understanding yet.

@marijnh
Copy link
Member

marijnh commented Jun 28, 2016

@0b10011 Do you want to take a look?

@0b10011
Copy link
Contributor

0b10011 commented Jun 29, 2016

Yeah, I should be able to get to this in the next 24-48 hours.

@0b10011
Copy link
Contributor

0b10011 commented Jul 10, 2016

Sorry about the delay! I've looked into this and added a PR that fixes the issue. Had to adjust the overlay.js code to make it possible for gfm to communicate effectively with markdown (to freeze markdown's state while parsing links).

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

No branches or pull requests

3 participants