2022-10-30 15:13:19 -07:00
|
|
|
# `MD038` - Spaces inside code span elements
|
2022-10-29 23:21:45 -07:00
|
|
|
|
2022-10-30 15:13:19 -07:00
|
|
|
Tags: `code`, `whitespace`
|
2022-10-29 23:21:45 -07:00
|
|
|
|
2022-10-30 15:13:19 -07:00
|
|
|
Aliases: `no-space-in-code`
|
2022-10-29 23:21:45 -07:00
|
|
|
|
2022-12-16 13:53:03 -08:00
|
|
|
Fixable: Some violations can be fixed by tooling
|
2022-10-29 23:21:45 -07:00
|
|
|
|
2025-02-02 21:36:35 -08:00
|
|
|
This rule is triggered for code spans that have content with spaces next to the
|
|
|
|
beginning or ending backticks:
|
2022-10-29 23:21:45 -07:00
|
|
|
|
|
|
|
```markdown
|
|
|
|
`some text `
|
|
|
|
|
|
|
|
` some text`
|
|
|
|
```
|
|
|
|
|
2025-02-02 21:36:35 -08:00
|
|
|
To fix this, remove any spaces at the beginning or ending:
|
2022-10-29 23:21:45 -07:00
|
|
|
|
|
|
|
```markdown
|
|
|
|
`some text`
|
|
|
|
```
|
|
|
|
|
2025-02-02 21:36:35 -08:00
|
|
|
Note: Code spans containing only spaces are allowed by the specification:
|
|
|
|
|
|
|
|
```markdown
|
|
|
|
` ` or ` `
|
|
|
|
```
|
|
|
|
|
2022-10-29 23:21:45 -07:00
|
|
|
Note: A single leading and trailing space is allowed by the specification and
|
2025-02-02 21:36:35 -08:00
|
|
|
automatically trimmed by the parser (in order to allow for code spans that embed
|
|
|
|
backticks):
|
2022-10-29 23:21:45 -07:00
|
|
|
|
|
|
|
```markdown
|
|
|
|
`` `backticks` ``
|
|
|
|
```
|
|
|
|
|
2022-11-05 17:34:37 -07:00
|
|
|
Note: A single leading or trailing space is allowed if used to separate code
|
2022-12-08 22:07:10 -08:00
|
|
|
span markers from an embedded backtick (though the space is not trimmed):
|
2022-10-29 23:21:45 -07:00
|
|
|
|
|
|
|
```markdown
|
|
|
|
`` ` embedded backtick``
|
|
|
|
```
|
|
|
|
|
2022-12-08 22:07:10 -08:00
|
|
|
Rationale: Violations of this rule are usually unintentional and may lead to
|
2025-02-02 21:36:35 -08:00
|
|
|
improperly-rendered content.
|