# MD031 - Fenced Code Blocks Should Be Surrounded by Blank Lines
## Description
This rule ensures that fenced code blocks are surrounded by blank lines. Adding blank lines before and after
fenced code blocks improves readability and ensures proper rendering across different Markdown processors.
## Examples
### Valid
```markdown
Text before the code block.
```markdown
Code block content
```
Text after the code block.
```
### Invalid
```markdown
Text before the code block.
```markdown
Code block content
```
Text after the code block.
```
### Fixed
```markdown
Text before the code block.
```markdown
Code block content
```
Text after the code block.
```
## Configuration
This rule has the following configuration options:
- `list_items`: Whether to require blank lines around fenced code blocks in list items. Default is `true`.
## Special Cases
- This rule applies to both fenced code blocks (using backticks or tildes)
- It checks for blank lines both before and after code blocks
- When `list_items` is set to `false`, code blocks in list items are exempt from this rule
## Related Rules
- [MD032 - Lists should be surrounded by blank lines](md032.md): Similar rule for lists
- [MD040 - Fenced code blocks should have a language specified](md040.md): Ensures code blocks specify a language
- [MD046 - Code block style](md046.md): Ensures consistent code block style