MD048 - Code Fence Style
Code fence style should be consistent.
Why This Rule Exists
Markdown supports two fence styles: backticks and tildes. Consistent style throughout a document improves readability and maintainability.
Styles
Backticks (Common)
```rust
let x = 1;
```
Tildes
~~~rust
let x = 1;
~~~
Examples
Incorrect (Mixed)
```python
print("Hello")
```
~~~bash
echo "World"
~~~
Correct
```python
print("Hello")
```
```bash
echo "World"
```
Configuration
[MD048]
style = "backtick" # Options: "backtick", "tilde", "consistent"
| Value | Description |
|---|---|
backtick | Use triple backticks |
tilde | Use triple tildes |
consistent | Match first fence's style |
When to Disable
- Documents with intentional style mixing
- Content with nested code blocks (tildes inside backticks)
Rule Details
- Rule ID: MD048
- Aliases: code-fence-style
- Category: Formatting
- Severity: Warning
- Auto-fix: Yes
Nesting Code Blocks
To show code fences inside code blocks, use different styles:
````markdown
```rust
let x = 1;
```
````