# MD048 - Code Fence Style
## Description
This rule ensures that code fence markers use a consistent style throughout a document. Markdown supports
two styles of code fence markers: backticks (```) and tildes (~~~).
By default, this rule enforces the use of backticks for code fence markers.
## Examples
### Valid
Consistent use of backticks (when style is set to "backtick"):
```javascript
function hello() {
console.log("Hello, world!");
}
```
```python
def hello():
print("Hello, world!")
```
### Invalid
Mixed code fence styles:
```javascript
function hello() {
console.log("Hello, world!");
}
```
~~~python
def hello():
print("Hello, world!")
~~~
### Fixed
```javascript
function hello() {
console.log("Hello, world!");
}
```
```python
def hello():
print("Hello, world!")
```
## Configuration
This rule has the following configuration options:
- `style`: The style of code fence markers to enforce. Can be one of:
- `"consistent"`: Enforce the first code fence style used in the document (default)
- `"backtick"`: Enforce the use of backticks (```)
- `"tilde"`: Enforce the use of tildes (~~~)
## Special Cases
- This rule only applies to fenced code blocks
- It does not apply to indented code blocks
- When style is set to "consistent", the first code fence style used in the document is enforced
- The rule checks both the opening and closing fence markers
- The rule preserves the language specifier when fixing code fence styles
## Related Rules
- [MD031 - Fenced code blocks should be surrounded by blank lines](md031.md): Ensures proper spacing around code blocks
- [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