# MD046 - Code Block Style

## Description

This rule ensures that code blocks use a consistent style throughout a document. Markdown supports  
two styles of code blocks: fenced code blocks (using backticks or tildes) and indented code blocks  
(using 4 spaces or 1 tab).

By default, this rule enforces the use of fenced code blocks for consistency.

<!-- markdownlint-disable -->
## Examples

### Valid

Fenced code blocks (when style is set to "fenced"):

```javascript
function hello() {
  console.log("Hello, world!");
}
```

### Invalid

Indented code blocks (when style is set to "fenced"):

    function hello() {
      console.log("Hello, world!");
    }

### Fixed

```javascript
function hello() {
  console.log("Hello, world!");
}
```
<!-- markdownlint-enable -->

## Configuration

This rule has the following configuration options:

- `style`: The style of code blocks to enforce. Can be one of:
  - `"consistent"`: Enforce the first code block style used in the document (default)
  - `"fenced"`: Enforce the use of fenced code blocks
  - `"indented"`: Enforce the use of indented code blocks

## Special Cases

- This rule applies to all code blocks in a document
- When style is set to "consistent", the first code block style used in the document is enforced
- The rule does not check the content of code blocks, only their style
- Fenced code blocks can use either backticks (```) or tildes (~~~)
- Indented code blocks must use 4 spaces or 1 tab for indentation

## 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
- [MD048 - Code fence style](md048.md): Ensures consistent code fence style
