Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Marked version: 1.2.2
Markdown flavor: GitHub Flavored Markdown
Description
Expectation
Links should support having inline code blocks opened with multiple backticks (2nd link in the example below). Even if the backtick closes the code block, there still should be a link (3rd link in the example below).
Reference:
https://spec.commonmark.org/dingus/?text=start%20links%0A%0A%5B%60%20this%20is%20a%20backtick%20and%20it%20does%20not%20break%20stuff%20%60%5D(https%3A%2F%2Fexample.com)%0A%0A%5B%60%60%20this%20is%20a%20backtick%20%60%20and%20it%20breaks%20stuff%20%60%60%5D(https%3A%2F%2Fexample.com)%0A%0A%5B%60%20this%20is%20a%20backtick%20%60%20which%20stops%20being%20code%20but%20is%20still%20a%20link%60%5D(https%3A%2F%2Fexample.com)%0A%0Aend%20links%0A%0A
(I included the screenshot because the custom commonmark URL only seems to work on Chrome, not Firefox)
Result
Marked, however, does not support the scenarios described above. It only supports code blocks in links when they are opened with a single backtick and closed with a single backtick.
Reference:
https://marked.js.org/demo/?text=start%20links%0A%0A%5B%60%20this%20is%20a%20backtick%20and%20it%20does%20not%20break%20stuff%20%60%5D(https%3A%2F%2Fexample.com)%0A%0A%5B%60%60%20this%20is%20a%20backtick%20%60%20and%20it%20breaks%20stuff%20%60%60%5D(https%3A%2F%2Fexample.com)%0A%0A%5B%60%20this%20is%20a%20backtick%20%60%20which%20stops%20being%20code%20but%20is%20still%20a%20link%60%5D(https%3A%2F%2Fexample.com)%0A%0Aend%20links%0A&options=%7B%0A%20%22baseUrl%22%3A%20null%2C%0A%20%22breaks%22%3A%20false%2C%0A%20%22gfm%22%3A%20true%2C%0A%20%22headerIds%22%3A%20true%2C%0A%20%22headerPrefix%22%3A%20%22%22%2C%0A%20%22highlight%22%3A%20null%2C%0A%20%22langPrefix%22%3A%20%22language-%22%2C%0A%20%22mangle%22%3A%20true%2C%0A%20%22pedantic%22%3A%20false%2C%0A%20%22sanitize%22%3A%20false%2C%0A%20%22sanitizer%22%3A%20null%2C%0A%20%22silent%22%3A%20false%2C%0A%20%22smartLists%22%3A%20false%2C%0A%20%22smartypants%22%3A%20false%2C%0A%20%22tokenizer%22%3A%20null%2C%0A%20%22xhtml%22%3A%20false%0A%7D&version=master
What was attempted
Now, instead of matching only a single-opening backtick + no backticks + single-closing backtick, as in
`[^`]*`
, anything can be matched inside the backticks, as in`.*`
.It correctly parsed the links, as shown below when I ran it locally:
Contributor
Committer
In most cases, this should be a different person than the contributor.