MD010 - Hard Tabs
Severity: Warning
Category: Whitespace
Auto-fix: ✓ Available
Rule Description
This rule checks for hard tab characters in the document and suggests replacing them with spaces for consistency.
Why This Rule Exists
Hard tabs can cause formatting inconsistencies:
- Tab width varies between editors (2, 4, or 8 spaces)
- Mixing tabs and spaces leads to misaligned text
- Different markdown renderers may handle tabs differently
- Code blocks and indentation become unpredictable
Examples
❌ Incorrect (violates rule)
→ This line starts with a tab
-→ List item with tab after marker
```→ Code block with tab indent
(Where → represents a tab character)
✅ Correct
This line uses spaces for indentation
- List item with spaces after marker
``` Code block with space indent
Configuration
[MD010]
code_blocks = true # Check for tabs in code blocks (default: true)
spaces_per_tab = 4 # Number of spaces to replace each tab with (default: 4)
Automatic Fix
This rule supports automatic fixing with --fix
. The fix will:
- Replace each tab character with the configured number of spaces
- Preserve the visual indentation of your content
- Handle tabs in all contexts (text, lists, code blocks)
Apply Fix
# Fix all tab issues in your markdown files
mdbook-lint lint --fix docs/
# Preview what would be fixed
mdbook-lint lint --fix --dry-run docs/
When to Disable
Consider disabling this rule if:
- Your project requires hard tabs (e.g., Makefiles in code examples)
- You're working with legacy content that uses tabs consistently
- Your team has standardized on tabs instead of spaces
Disable in Config
# .mdbook-lint.toml
disabled_rules = ["MD010"]
Disable Inline
<!-- mdbook-lint-disable MD010 -->
→ Content with tabs allowed here
<!-- mdbook-lint-enable MD010 -->
Related Rules
- MD009 - No trailing spaces
- MD012 - Multiple consecutive blank lines
- MD047 - Files should end with newline