Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

MD038 - Spaces Inside Code Spans

Spaces inside code span markers.

Why This Rule Exists

Extra spaces inside backticks create inconsistent code formatting. The spaces become part of the rendered code, which usually isn't intended.

Examples

Incorrect

Use the ` print() ` function.

Run ` npm install ` to install.

Correct

Use the `print()` function.

Run `npm install` to install.

Intentional Spaces

If you need a backtick inside code, use double backticks with spaces:

Use `` `backticks` `` for code.

Configuration

This rule has no configuration options.

When to Disable

  • Documents using spaces for specific code formatting
  • Content requiring literal spaces in code spans

Rule Details

  • Rule ID: MD038
  • Aliases: no-space-in-code
  • Category: Code
  • Severity: Warning
  • Auto-fix: Yes (removes extra spaces)
  • MD037 - Spaces inside emphasis
  • MD039 - Spaces inside link text
  • MD040 - Fenced code blocks language