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

A backtick in code in a link parses incorrectly #1663

Open
leafac opened this issue May 3, 2020 · 8 comments
Open

A backtick in code in a link parses incorrectly #1663

leafac opened this issue May 3, 2020 · 8 comments
Labels
category: links L1 - broken Valid usage causes incorrect output OR a crash AND there is no known workaround for the issue

Comments

@leafac
Copy link

leafac commented May 3, 2020

Marked

CommonMark

It used to work in Marked 0.6.3

@UziTech
Copy link
Member

UziTech commented May 3, 2020

There was a security issue with backticks in links as shown in #1493 and fixed in #1515 Released in v0.7.0

@UziTech UziTech added category: links L1 - broken Valid usage causes incorrect output OR a crash AND there is no known workaround for the issue labels May 3, 2020
@leafac
Copy link
Author

leafac commented May 29, 2020

Can I help to fix this?

@UziTech
Copy link
Member

UziTech commented May 29, 2020

Of course! PRs are always welcome.

@leafac
Copy link
Author

leafac commented May 29, 2020

I should have said: Can you please help me fix this?

I’m new to the codebase and have no idea where to start.

@UziTech
Copy link
Member

UziTech commented May 30, 2020

You will most likely have to change the regex for links in rules.js and update the link tokenizer in Tokenizer.js.

If you have any questions about anything feel free to ask.

@leafac
Copy link
Author

leafac commented Jun 1, 2020

I thought I’d have time to work on this, but I won’t. If someone else can take this, it’d be great 😃

pgcalixto added a commit to pgcalixto/marked that referenced this issue Oct 21, 2020
Previously, when there as an inline code as a link label, it would
only work if the backticks were single-opened and single-closed
(as in 1 backtick opening the code block + 1 backtick closing the
code block).
Now one can use more than 1 backtick to open/close the inline code
block as a link label.

Closes markedjs#1663.
@pgcalixto
Copy link

pgcalixto commented Oct 22, 2020

Hey guys, I got here by looking for projects to contribute to during the Hacktoberfest. I opened a pull request to address this issue: #1794.

@UziTech, I updated the links in rules.js but apparently didn't need to update Tokenizer.js.

The PR passed all tests and I was looking where I could include a test case for this scenario of backticks in links.
However, as I inspected tests/specs/commonmark and tests/specs/gfm, the test cases seem to be based on examples from the CommonMark and GitHub specs, and do not support custom test cases.

Is there a test file where this scenario could be added?

@UziTech
Copy link
Member

UziTech commented Oct 22, 2020

test/specs/new is where you will need to add tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: links L1 - broken Valid usage causes incorrect output OR a crash AND there is no known workaround for the issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants