MD031 - Blanks Around Fences
Fenced code blocks should be surrounded by blank lines.
Why This Rule Exists
Blank lines around code blocks improve readability and ensure consistent rendering. Some parsers may not correctly identify code blocks without surrounding blank lines.
Examples
Incorrect
Some text here.
```code
let x = 1;
More text here.
### Correct
```markdown
Some text here.
```code
let x = 1;
More text here.
## Configuration
```toml
[MD031]
list_items = true # Apply rule inside list items (default: true)
When to Disable
- Documents with compact formatting requirements
- Content where code blocks intentionally flow with text
Rule Details
- Rule ID: MD031
- Aliases: blanks-around-fences
- Category: Formatting
- Severity: Warning
- Auto-fix: Yes