[GH-ISSUE #489] MD038 edge case with internal backticks #401

Closed
opened 2026-03-03 01:26:36 +03:00 by kerem · 5 comments
Owner

Originally created by @nschonni on GitHub (Jan 21, 2022).
Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/489

The following doesn't trigger, although it does have internal padding space

` HTMLMediaElement``.src `

This is something that was just a bug in terminating the code fence and re-opening it again, but it should still flag the MD038 since both the code spans have MD038 issues

https://dlaa.me/markdownlint/#%25m%60%20HTMLMediaElement%60%60.src%20%60

Originally created by @nschonni on GitHub (Jan 21, 2022). Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/489 The following doesn't trigger, although it does have internal padding space ```md ` HTMLMediaElement``.src ` ``` This is something that was just a bug in terminating the code fence and re-opening it again, but it should still flag the MD038 since both the code spans have MD038 issues https://dlaa.me/markdownlint/#%25m%60%20HTMLMediaElement%60%60.src%20%60
kerem 2026-03-03 01:26:36 +03:00
  • closed this issue
  • added the
    question
    label
Author
Owner

@nschonni commented on GitHub (Jan 22, 2022):

Found some more of the odd ones searching over in mdn/content with this regex:

[^`]+``[^`]+"
<!-- gh-comment-id:1018980207 --> @nschonni commented on GitHub (Jan 22, 2022): Found some more of the odd ones searching over in mdn/content with this regex: ``` [^`]+``[^`]+" ```
Author
Owner

@nschonni commented on GitHub (Jan 22, 2022):

Actually, I'm thinking this might not be fixable, since I think the padding is actually according to CommonMark with this edge case, but unintentionally incorrect from their HTML -> MD migration

<!-- gh-comment-id:1018984932 --> @nschonni commented on GitHub (Jan 22, 2022): Actually, I'm thinking this might not be fixable, since I think the padding is actually according to CommonMark with this edge case, but unintentionally incorrect from their HTML -> MD migration
Author
Owner

@nschonni commented on GitHub (Jan 22, 2022):

Here are the ones I picked up in that repo https://github.com/mdn/content/pull/12325

<!-- gh-comment-id:1018989117 --> @nschonni commented on GitHub (Jan 22, 2022): Here are the ones I picked up in that repo https://github.com/mdn/content/pull/12325
Author
Owner

@DavidAnson commented on GitHub (Jan 22, 2022):

Like you said, CommonMark allows codes spans to have a single space at the beginning and end (and will remove both) in order to allow code that begins or ends with a backtick (though the code isn't required to do so). Your example above meets this criteria, but I can't tell from here if that's a bad conversion or deliberate.

https://spec.commonmark.org/0.30/#code-spans

<!-- gh-comment-id:1018998091 --> @DavidAnson commented on GitHub (Jan 22, 2022): Like you said, CommonMark allows codes spans to have a single space at the beginning and end (and will remove both) in order to allow code that begins or ends with a backtick (though the code isn't required to do so). Your example above meets this criteria, but I can't tell from here if that's a bad conversion or deliberate. https://spec.commonmark.org/0.30/#code-spans
Author
Owner

@nschonni commented on GitHub (Jan 22, 2022):

Yeah, looks like this is a case of https://spec.commonmark.org/0.30/#example-340
I think there were a few deliberate ones in the conversion and a few mistakes, but I don't think Markdownlint can actually tell the difference since they are valid in those examples

<!-- gh-comment-id:1019323306 --> @nschonni commented on GitHub (Jan 22, 2022): Yeah, looks like this is a case of https://spec.commonmark.org/0.30/#example-340 I think there were a few deliberate ones in the conversion and a few mistakes, but I don't think Markdownlint can actually tell the difference since they are valid in those examples
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#401
No description provided.