mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-09-22 05:40:48 +02:00
Refactor MD038/no-space-in-code to produce smaller/simpler edits and address an additional scenario.
This commit is contained in:
parent
656254e64f
commit
b23fc96ab2
8 changed files with 699 additions and 610 deletions
|
@ -1,38 +1,44 @@
|
|||
This rule is triggered for code spans that have content with spaces next to the
|
||||
beginning or ending backticks:
|
||||
This rule is triggered for code spans containing content with unnecessary space
|
||||
next to the beginning or ending backticks:
|
||||
|
||||
```markdown
|
||||
`some text `
|
||||
|
||||
` some text`
|
||||
|
||||
` some text `
|
||||
```
|
||||
|
||||
To fix this, remove any spaces at the beginning or ending:
|
||||
To fix this, remove the extra space characters from the beginning and ending:
|
||||
|
||||
```markdown
|
||||
`some text`
|
||||
```
|
||||
|
||||
Note: Code spans containing only spaces are allowed by the specification:
|
||||
|
||||
```markdown
|
||||
` ` or ` `
|
||||
```
|
||||
|
||||
Note: A single leading and trailing space is allowed by the specification and
|
||||
automatically trimmed by the parser (in order to allow for code spans that embed
|
||||
backticks):
|
||||
Note: A single leading *and* trailing space is allowed by the specification and
|
||||
trimmed by the parser to support code spans that begin or end with a backtick:
|
||||
|
||||
```markdown
|
||||
`` `backticks` ``
|
||||
|
||||
`` backtick` ``
|
||||
```
|
||||
|
||||
Note: A single leading or trailing space is allowed if used to separate code
|
||||
span markers from an embedded backtick (though the space is not trimmed):
|
||||
Note: When single-space padding is present in the input, it will be preserved
|
||||
(even if unnecessary):
|
||||
|
||||
```markdown
|
||||
`` ` embedded backtick``
|
||||
` code `
|
||||
```
|
||||
|
||||
Rationale: Violations of this rule are usually unintentional and may lead to
|
||||
Note: Code spans containing only spaces are allowed by the specification and are
|
||||
also preserved:
|
||||
|
||||
```markdown
|
||||
` `
|
||||
|
||||
` `
|
||||
```
|
||||
|
||||
Rationale: Violations of this rule are usually unintentional and can lead to
|
||||
improperly-rendered content.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue