Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MD038: Code span containing only spaces #1481

Open
straight-shoota opened this issue Feb 1, 2025 · 0 comments
Open

MD038: Code span containing only spaces #1481

straight-shoota opened this issue Feb 1, 2025 · 0 comments

Comments

@straight-shoota
Copy link

When a code span contains only spaces, I think MD038 should not apply.

CommonMark describes that case to be taken as is without chopping off leading or trailing spaces (https://spec.commonmark.org/0.31.2/#code-spans).

When there are only spaces, it's very likely that they're intentional. That premise for MD038 is to avoid unintentional whitespace.
And it's even more likely that the automatic fix is much less intentional: markdownlint --fix removes all spaces.
This results in an empty code span, which is not even a valid code span. Thus the fix definitely changes semantics.
In my opinion the fix behaviour is wrong. The rule violation maybe not as clearly wrong, but I'd suggest to exempt code spans with only spaces from MD038.

Original:

` `

`  `

`   `

Original, rendered in GitHub:

Result of markdownlint --fix:

``

``

``

Result of markdownlint --fix, rendered in GitHub:

``

``

``

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants