MDS044: horizontal-rule-style
Thematic breaks must use a consistent delimiter style, exact length, and blank-line spacing.
CommonMark accepts ---, ***, and ___ with any length ≥ 3
and optional internal spaces. This rule pins one delimiter,
enforces an exact length, and requires surrounding blank lines
so --- cannot be confused with a setext heading underline.
# Settings
| Setting | Type | Default | Description |
|---|---|---|---|
style | string | "dash" | Delimiter character: "dash" (---), "asterisk" (***), or "underscore" (___). |
length | int | 3 | Exact number of delimiter characters required (minimum 3). |
require-blank-lines | bool | true | Blank lines must appear before and after each thematic break. |
# Config
Enable with defaults:
rules:
horizontal-rule-style:
style: dash
length: 3
require-blank-lines: trueDisable:
rules:
horizontal-rule-style: falseCustom (asterisk style, length 5):
rules:
horizontal-rule-style:
style: asterisk
length: 5# Diagnostics
horizontal rule uses {actual}; configured style is {expected}
horizontal rule has internal spaces
horizontal rule has length {actual}; configured length is {expected}
horizontal rule needs a blank line above
horizontal rule needs a blank line below# Examples
# Good (default settings)
# Test Document
Some text before.
---
Some text after.# Good (asterisk style)
# Test Document
Some text before.
***
Some text after.# Bad (wrong delimiter)
# Test Document
Some text before.
***
Some text after.# Bad (internal spaces)
# Test Document
Some text before.
- - -
Some text after.# Bad (wrong length)
# Test Document
Some text before.
-----
Some text after.# Bad (missing blank line above)
# Test Document
---
Text after.# Bad (missing blank line below)
# Test Document
---
Text after.# Auto-fix
The rule rewrites each thematic break to the canonical form
(style repeated length times). It also inserts any missing
blank lines above and below.