[GH-ISSUE #956] '\' used to escape a '_' in the URL is invalid according to MD051 #2413

Closed
opened 2026-03-07 20:07:32 +03:00 by kerem · 4 comments
Owner

Originally created by @FlorentPoinsaut on GitHub (Sep 6, 2023).
Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/956

The '' character used to escape a '_' character in the URL is invalid according to MD051.

Example : [nfs](#module\_nfs) is invalid

But if I try here, it is correctly interpreted: https://spec.commonmark.org/dingus/?text=%5Bnfs%5D(%23module_nfs)%20%0A&smart=1

Is this deliberate behaviour?
I'm wondering because this breaks compatibility with terrafom-docs and I'd like to know whether I should ask them to correct this or not :-D

Originally created by @FlorentPoinsaut on GitHub (Sep 6, 2023). Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/956 The '\' character used to escape a '_' character in the URL is invalid according to MD051. Example : `[nfs](#module\_nfs)` is invalid But if I try here, it is correctly interpreted: https://spec.commonmark.org/dingus/?text=%5Bnfs%5D(%23module_nfs)%20%0A&smart=1 Is this deliberate behaviour? I'm wondering because this breaks compatibility with [terrafom-docs](https://terraform-docs.io/) and I'd like to know whether I should ask them to correct this or not :-D
kerem 2026-03-07 20:07:32 +03:00
Author
Owner

@DavidAnson commented on GitHub (Sep 6, 2023):

It should be unnecessary to escape the underscore in that scenario, but I need to look at the specifications to see if it's wrong to do so. I notice that the backslash is ignored in your example and by the markdown-it parser. I will look into this more when I'm not on my phone.

<!-- gh-comment-id:1708622629 --> @DavidAnson commented on GitHub (Sep 6, 2023): It should be unnecessary to escape the underscore in that scenario, but I need to look at the specifications to see if it's wrong to do so. I notice that the backslash is ignored in your example and by the markdown-it parser. I will look into this more when I'm not on my phone.
Author
Owner

@DavidAnson commented on GitHub (Sep 6, 2023):

It seems to be ignored by the micromark parser as well.

<!-- gh-comment-id:1708625477 --> @DavidAnson commented on GitHub (Sep 6, 2023): It seems to be ignored by the micromark parser as well.
Author
Owner

@DavidAnson commented on GitHub (Sep 7, 2023):

CommonMark explicitly allows backslash escapes in link destinations: https://spec.commonmark.org/0.30/#example-22

<!-- gh-comment-id:1709437664 --> @DavidAnson commented on GitHub (Sep 7, 2023): CommonMark explicitly allows backslash escapes in link destinations: https://spec.commonmark.org/0.30/#example-22
Author
Owner

@FlorentPoinsaut commented on GitHub (Sep 8, 2023):

Thank you so much for your responsiveness and all your hard work!

<!-- gh-comment-id:1711178713 --> @FlorentPoinsaut commented on GitHub (Sep 8, 2023): Thank you so much for your responsiveness and all your hard work!
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/markdownlint#2413
No description provided.