mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2026-04-25 17:26:22 +03:00
[GH-ISSUE #269] MD034 triggered when URL is escaped in the protocol section #229
Labels
No labels
bug
enhancement
enhancement
enhancement
fixed in next
fixed in next
fixed in next
new rule
new rule
new rule
pull-request
question
refactoring
refactoring
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/markdownlint#229
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @nschonni on GitHub (Mar 31, 2020).
Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/269
https://dlaa.me/markdownlint/#%25mhttp%5C%3A%2F%2Fwww.contoso.com
Sometimes you want to show a link without the autolink happening, so you escape one of the characters in the
://sequence. It seems the reqex for the rule is ignoring that and still treating it as a link.@DavidAnson commented on GitHub (Mar 31, 2020):
The RegExp is applied after parsing, so it doesn’t see the ‘\’. What about the suggestion to use a code block at the end of the rule documentation? https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#md034
@DavidAnson commented on GitHub (Mar 31, 2020):
The
markdown-itparser doesn’t seem to ignore the link using this technique:https://markdown-it.github.io/#md3=%7B%22source%22%3A%22http%5C%5C%3A%2F%2Fwww.contoso.com%22%2C%22defaults%22%3A%7B%22html%22%3Afalse%2C%22xhtmlOut%22%3Afalse%2C%22breaks%22%3Afalse%2C%22langPrefix%22%3A%22language-%22%2C%22linkify%22%3Atrue%2C%22typographer%22%3Atrue%2C%22_highlight%22%3Atrue%2C%22_strict%22%3Afalse%2C%22_view%22%3A%22html%22%7D%7D
@nschonni commented on GitHub (Mar 31, 2020):
Sorry, I stripped down the example to the minimum viable, but in the case I came across, it was being escaped to it could be bolded/emphasized, so the backticks wouldn't work.
@DavidAnson commented on GitHub (Apr 1, 2020):
As I note above, the trick you show with backslash does not work with the
markdown-itparser which means it shouldn’t work with any CommonMark parser.There are other tricks:
But they are all unsightly and some break the link.
Ultimately, I think my recommendation is to disable MD034 for this scenario, either per-line, file, or project. Or disable auto-linking in the relevant Markdown parser (good ones should provide this option).
@nschonni commented on GitHub (Apr 1, 2020):
This is for docs.microsoft.com content, so Markdig :)
@DavidAnson commented on GitHub (Apr 2, 2020):
This works (using the zero-width non-breaking space character), though it’s pretty ugly in the source. However, I think it’s the best I can offer:
https://dlaa.me/markdownlint/#%25m%23%20Issue%20269%0A%0Ahttp%3A%26%2365279%3B%2F%2Fwww.contoso.com%0A
@nschonni commented on GitHub (Apr 2, 2020):
For the particular PR, they ended up just disabling the rule for it. Probably something for Markdown-it I guess, so it doesn't appear as a link in the AST
@DavidAnson commented on GitHub (Apr 6, 2020):
No clear fix here, and the issue seems to be mitigated by disabling the rule.
@nschonni commented on GitHub (Feb 10, 2022):
Ha, when to open up this issue again because I've hit it again on mdn/content 😄
FYI, I've got the basic config in that repo now, but it isn't fully plugged into the CI yet, so there is still regular regressions