2022-10-30 15:13:19 -07:00
|
|
|
# `MD046` - Code block style
|
2022-10-29 23:21:45 -07:00
|
|
|
|
2022-10-30 15:13:19 -07:00
|
|
|
Tags: `code`
|
2022-10-29 23:21:45 -07:00
|
|
|
|
2022-10-30 15:13:19 -07:00
|
|
|
Aliases: `code-block-style`
|
2022-10-29 23:21:45 -07:00
|
|
|
|
|
|
|
Parameters:
|
|
|
|
|
2022-11-13 20:53:10 -08:00
|
|
|
- `style`: Block style (`string`, default `consistent`, values `consistent` /
|
2022-11-05 17:34:37 -07:00
|
|
|
`fenced` / `indented`)
|
2022-10-29 23:21:45 -07:00
|
|
|
|
|
|
|
This rule is triggered when unwanted or different code block styles are used in
|
|
|
|
the same document.
|
|
|
|
|
2022-11-05 17:34:37 -07:00
|
|
|
In the default configuration this rule reports a violation for the following
|
|
|
|
document:
|
2022-10-29 23:21:45 -07:00
|
|
|
|
|
|
|
<!-- markdownlint-disable code-block-style -->
|
|
|
|
|
|
|
|
Some text.
|
|
|
|
|
|
|
|
# Indented code
|
|
|
|
|
|
|
|
More text.
|
|
|
|
|
|
|
|
```ruby
|
|
|
|
# Fenced code
|
|
|
|
```
|
|
|
|
|
|
|
|
More text.
|
|
|
|
|
|
|
|
<!-- markdownlint-restore -->
|
|
|
|
|
|
|
|
To fix violations of this rule, use a consistent style (either indenting or code
|
|
|
|
fences).
|
|
|
|
|
|
|
|
The specified style can be specific (`fenced`, `indented`) or simply require
|
|
|
|
that usage be consistent within the document (`consistent`).
|
|
|
|
|
|
|
|
Rationale: Consistent formatting makes it easier to understand a document.
|