MDS064: atx-heading-whitespace
ATX heading whitespace and indentation.
Flags malformed ATX headings. When the heading has content, checks that the
opening hashes are followed by exactly one space (not a tab, not two spaces);
empty headings (## with nothing after the hashes) are valid. Also checks
that the heading starts at column 1, and that no closing hash sequence appears
after the content.
A trailing # run is only treated as a closing marker when preceded by
whitespace; a # with no preceding space is kept as content.
A line that continues a paragraph is never checked. In CommonMark that line is
paragraph text: #48 there is not a heading, and a real ATX heading would have
ended the paragraph. So a wrapped [Issue #48](url) link that puts #48 at
the start of a line is left alone, and the fix never splits the paragraph
around a heading nobody wrote. This covers lazy continuation lines in list
items and block quotes too. A #48 line that opens a paragraph is still
flagged.
This holds for heading syntax too. #Heading right under a paragraph line,
with no blank line between them, is paragraph text in CommonMark. MDS064 does
not flag it, and the fix does not touch it:
Before
#HeadingTo make that line a heading, put a blank line before it and a space after the
#.
# Config
Enable:
rules:
atx-heading-whitespace: trueDisable:
rules:
atx-heading-whitespace: false# Examples
# Bad
Missing space after #:
#HeadingMultiple spaces after #:
# HeadingIndented heading:
# HeadingClosing # marker (any whitespace before #):
# Heading #Multiple spaces before closing #:
# Heading #Tab after opening #:
# Heading# Good
# Heading
## Section
### SubsectionA # on a paragraph continuation line is paragraph text:
The fix landed in [Issue
#48](https://example.com/issues/48).# Meta-Information
- ID: MDS064
- Name:
atx-heading-whitespace - Status: ready
- Default: enabled
- Fixable: yes
- Implementation: source
- Category: heading
- markdownlint:
- rumdl:
- mado:
- obsidian-linter: headings-start-line (partial)