[GH-ISSUE #641] MD038 suggested fixes do not render well on GitHub. Or, I misunderstand their purpose. #486

Closed
opened 2026-03-03 01:27:20 +03:00 by kerem · 6 comments
Owner

Originally created by @Ben-Voris on GitHub (Nov 17, 2022).
Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/641

What I want is a block of text that my user's can copy from a markdown file that includes a trailing space. E.g., something like

"prefix - "

The double quotes are to show what I want and to show that GitHub markdown renders the trailing space.

Specifically, this from MD038 - Spaces inside code span elements

Note: A single leading and trailing space is allowed by the specification and automatically trimmed (to allow for embedded backticks):

`backticks`
Note: A single leading or trailing space is allowed if used to separate code span markers from an embedded backtick:

` embedded backtick

The first example displays the a backtick, the text, and a backtick:

`backticks`

The second displays a backtick, followed by a space, followed by the text:

` embedded backtick

Other than ignoring the warning, another workaround is

prefix - 
as shown here. But, at least on GitHub, that introduces a line break that I don't want.

Finally, the markdown preview in VS Code 1.73.1 appears to render these the same as GitHub, itself.

Originally created by @Ben-Voris on GitHub (Nov 17, 2022). Original GitHub issue: https://github.com/DavidAnson/markdownlint/issues/641 What I want is a block of text that my user's can copy from a markdown file that includes a trailing space. E.g., something like "`prefix - `" The double quotes are to show what I want and to show that GitHub markdown renders the trailing space. Specifically, this from [MD038 - Spaces inside code span elements](https://github.com/DavidAnson/markdownlint/blob/v0.26.2/doc/Rules.md#md038) > > Note: A single leading and trailing space is allowed by the specification and automatically trimmed (to allow for embedded backticks): > > `` `backticks` `` > Note: A single leading or trailing space is allowed if used to separate code span markers from an embedded backtick: > > `` ` embedded backtick`` > The first example displays the a backtick, the text, and a backtick: ``` `backticks` ``` The second displays a backtick, followed by a space, followed by the text: ``` ` embedded backtick ``` Other than ignoring the warning, another workaround is <pre>prefix - </pre> as shown here. But, at least on GitHub, that introduces a line break that I don't want. Finally, the markdown preview in VS Code 1.73.1 appears to render these the same as GitHub, itself.
kerem 2026-03-03 01:27:20 +03:00
Author
Owner

@DavidAnson commented on GitHub (Nov 17, 2022):

MD038 exists to help authors avoid accidentally including a space on either edge of an inline code span. If you specifically want to include a space, you probably want to suppress this rule because its guidance does not apply.

<!-- gh-comment-id:1319346616 --> @DavidAnson commented on GitHub (Nov 17, 2022): MD038 exists to help authors avoid accidentally including a space on either edge of an inline code span. If you specifically want to include a space, you probably want to suppress this rule because its guidance does not apply.
Author
Owner

@Ben-Voris commented on GitHub (Nov 18, 2022):

I thought the reason for the rule was that space would not render consistently. If that's not so, I don't understand the motivation.

<!-- gh-comment-id:1320145345 --> @Ben-Voris commented on GitHub (Nov 18, 2022): I thought the reason for the rule was that space would not render consistently. If that's not so, I don't understand the motivation.
Author
Owner

@DavidAnson commented on GitHub (Nov 18, 2022):

Similar to MD037 and MD039, extra space on the edge of emphasis and links is usually unnecessary and probably not what the author intended. These rules call that out, but of course if that is being done intentionally, then it is perfectly appropriate to disable the rules for that line, file, or project.

<!-- gh-comment-id:1320309298 --> @DavidAnson commented on GitHub (Nov 18, 2022): Similar to MD037 and MD039, extra space on the edge of emphasis and links is usually unnecessary and probably not what the author intended. These rules call that out, but of course if that is being done intentionally, then it is perfectly appropriate to disable the rules for that line, file, or project.
Author
Owner

@DavidAnson commented on GitHub (Nov 18, 2022):

As the "rationale" for each rule indicates, having spaces present can lead to rendering problems in some cases. In others, it is just potentially unsightly.

<!-- gh-comment-id:1320312576 --> @DavidAnson commented on GitHub (Nov 18, 2022): As the "rationale" for each rule indicates, having spaces present can lead to rendering problems in some cases. In others, it is just potentially unsightly.
Author
Owner

@Ben-Voris commented on GitHub (Nov 18, 2022):

Thank you for the explanation.
Others might be as confused as I as to the purpose of the examples, so adding a few words about that might help.
For some reason Github does not show the close button to me. If you choose to close this, please would you do that?

<!-- gh-comment-id:1320617147 --> @Ben-Voris commented on GitHub (Nov 18, 2022): Thank you for the explanation. Others might be as confused as I as to the purpose of the examples, so adding a few words about that might help. For some reason Github does not show the close button to me. If you choose to close this, please would you do that?
Author
Owner

@DavidAnson commented on GitHub (Nov 18, 2022):

I'll add a bit to the role description to try to explain this. Thanks.

<!-- gh-comment-id:1320657508 --> @DavidAnson commented on GitHub (Nov 18, 2022): I'll add a bit to the role description to try to explain this. Thanks.
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#486
No description provided.