[GH-ISSUE #473] MD038 Should catch code spans that start AND end with spaces #390

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

Originally created by @TheJaredWilcurt on GitHub (Dec 28, 2021).
Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/473

MD038 - Spaces inside code span elements

Example code:

caught: ` text`

caught: `text `

missed: ` text `

valid: `text`

Should work similar to MD039 - Spaces inside link text

[ caught](https://github.com)

[caught ](https://github.com)

[ caught ](https://github.com)

[valid](https://github.com)

Reproduction:

Originally created by @TheJaredWilcurt on GitHub (Dec 28, 2021). Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/473 [MD038](https://github.com/DavidAnson/markdownlint/blob/main/doc/Rules.md#md038) - Spaces inside code span elements Example code: ```md caught: ` text` caught: `text ` missed: ` text ` valid: `text` ``` Should work similar to [MD039](https://github.com/DavidAnson/markdownlint/blob/main/doc/Rules.md#md038) - Spaces inside link text ```md [ caught](https://github.com) [caught ](https://github.com) [ caught ](https://github.com) [valid](https://github.com) ``` * * * **Reproduction:** * [https://dlaa.me/markdownlint](https://dlaa.me/markdownlint/#%25m%23%20Issue%20473%0A%0Acaught:%20%60%20text%60%0A%0Acaught:%20%60text%20%60%0A%0Amissed:%20%60%20text%20%60%0A%0Avalid:%20%60text%60%0A)
kerem 2026-03-03 01:26:29 +03:00
  • closed this issue
  • added the
    question
    label
Author
Owner

@TheJaredWilcurt commented on GitHub (Dec 28, 2021):

Also, this worked in version 0.22.0 and stopped working in 0.23.0+.

<!-- gh-comment-id:1002306176 --> @TheJaredWilcurt commented on GitHub (Dec 28, 2021): Also, this worked in version `0.22.0` and stopped working in `0.23.0`+. * https://github.com/DavidAnson/markdownlint/compare/v0.22.0...v0.23.0
Author
Owner

@DavidAnson commented on GitHub (Dec 28, 2021):

Sorry about that! To be clear, I just released version 0.25.0 last night, but you are saying this broke two versions before that? Just coincidental timing, I guess?

<!-- gh-comment-id:1002308467 --> @DavidAnson commented on GitHub (Dec 28, 2021): Sorry about that! To be clear, I just released version 0.25.0 last night, but you are saying this broke two versions before that? Just coincidental timing, I guess?
Author
Owner

@TheJaredWilcurt commented on GitHub (Dec 28, 2021):

Oops, the version numbers are actually from markdownlint-cli

Which changed from ~0.19.0 to ~0.20.2 in it's deps.

<!-- gh-comment-id:1002309507 --> @TheJaredWilcurt commented on GitHub (Dec 28, 2021): Oops, the version numbers are actually from `markdownlint-cli` * https://github.com/igorshubovych/markdownlint-cli/compare/v0.22.0...v0.23.0 Which changed from `~0.19.0` to `~0.20.2` in it's deps. * https://github.com/DavidAnson/markdownlint/compare/v0.19.0...v0.20.2
Author
Owner

@DavidAnson commented on GitHub (Dec 28, 2021):

I couldn't figure out how I would've missed this for so long. It turns out, it's deliberate!

Here's the commit that allows it: github.com/DavidAnson/markdownlint@bdc0246b34

The second bullet point here explains why: https://spec.commonmark.org/0.30/#code-spans

<!-- gh-comment-id:1002325396 --> @DavidAnson commented on GitHub (Dec 28, 2021): I couldn't figure out how I would've missed this for so long. It turns out, it's deliberate! Here's the commit that allows it: https://github.com/DavidAnson/markdownlint/commit/bdc0246b34040c0e75b0acdd3a92ea4539f7d52b The second bullet point here explains why: https://spec.commonmark.org/0.30/#code-spans
Author
Owner

@TheJaredWilcurt commented on GitHub (Jan 7, 2022):

An unfortunate edge case.

<!-- gh-comment-id:1007565829 --> @TheJaredWilcurt commented on GitHub (Jan 7, 2022): An unfortunate edge case.
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#390
No description provided.