Skip to content

heading-style

all languagesstylefix: safedefault: offmarkdown/markdownlint

Reports a heading written in another style than the document’s: # before the text (ATX) or the text over a line of = or - (setext). The option style is atx, setext or consistent (the style of the first heading, the default). The fix rewrites a one-line heading of level 1 or 2.

Two heading styles in one document make it look edited by different hands, and tools that search for headings (outlines, scripts) must know both. Only level 1 and 2 have a setext form, so ATX is the one style that works for every level.

To fix, use the style of the document; the fix does it for level 1 and 2.

Reported
# Title
Section
=======
Sub
---
## Atx
Two
lines
---
lint:
rules:
heading-style:
level: warn # off (default), warn, error
options:
style: "consistent"
kind: "Heading"
Option Type Default Description
style string "consistent" atx, setext, or consistent (the first heading’s style).
Values: consistent, atx, setext
kind string "Heading" The name of the grammar kind of a heading node.

Enabled by the presets: markdown/markdownlint.

Suppress one line with sudsy-disable-next-line heading-style in a comment of the file’s language.

The same check in other tools. full: Sudsy reports what the upstream rule reports; partial: only part of it, as the last column says.

Tool Rule Match What differs
markdownlint MD003 partial consistent only (the first heading’s style); the fix writes a setext heading of one line as atx, the other way is not fixed. No setext_with_atx styles.