consistent-inline-code-style
🎨 Stylistic
🔧 Fixable
⭐ CommonMark
🌟 GFM
Enforce consistent inline code style.
Rule Details
This rule enforces a single, consistent style for inline code in Markdown files by disallowing extra spaces or tabs next to the opening and closing backticks.
An inline code is defined as text wrapped in backticks. While Markdown allows a single leading and trailing space when needed, this rule ensures that there are no extra spaces or tabs next to the opening and closing backticks, which can reduce readability.
Examples
❌ Incorrect
Examples of incorrect code for this rule:
Default
<!-- eslint md/consistent-inline-code-style: 'error' -->
` some text`
`some text `
` some text `✅ Correct
Examples of correct code for this rule:
Default
<!-- eslint md/consistent-inline-code-style: 'error' -->
`some text`A single leading and trailing space is allowed by the CommonMark specification and trimmed by the parser to support code spans that begin or end with a backtick:
<!-- eslint md/consistent-inline-code-style: 'error' -->
`` `backticks` ``
`` `backtick ``
`` backtick` ``When single-space padding is present in the input, it will be preserved even if unnecessary:
<!-- eslint md/consistent-inline-code-style: 'error' -->
` code `Code spans containing only spaces are allowed by the CommonMark specification and are also preserved:
<!-- eslint md/consistent-inline-code-style: 'error' -->
` `
` `Options
No options are available for this rule.
Fix
This rule fixes the inline code by removing extra spaces or tabs next to the opening and closing backticks.