MDS065: code-block-style
Code blocks must use a single delimiter — fenced or four-space indented — consistently across the file.
# Settings
| Setting | Type | Default | Description |
|---|---|---|---|
style | string | "fenced" | "consistent" (first block sets the convention), "fenced" (```), or "indented" (four-space). |
# Autofix
mdsmith fix converts each indented code block to a fenced
block when the resolved style is fenced. The converted block
gets the language tag text so the result satisfies
fenced-code-language (MDS011); edit it to the real language
after fixing.
The new fence is sized to clear any backtick run at the start
of a content line, so the embedded run never closes the
converted block prematurely. A block with a ``` line is
wrapped in a 4-backtick fence; a block with ```` gets a
5-backtick fence; and so on.
The reverse direction (fenced → indented) is not auto-applied: it would drop any language tag set on the fenced block.
# Config
Enable (default — fenced style):
rules:
code-block-style:
style: fencedDisable:
rules:
code-block-style: falseRequire four-space indented blocks:
rules:
code-block-style:
style: indentedPin the style to whichever the first block uses:
rules:
code-block-style:
style: consistent# Examples
# Good — default style
# Title
```go
fmt.Println("hello")
```#
Good — style: indented
# Title
Some text first.
indented code# Bad — default style
# Title
Some text first.
indented code