Heading conversion

Version 0.6.1 Updated Sep 29, 2026

Pass --headings to convert Setext headings into ATX headings. A Setext heading is a paragraph line followed by an underline of three or more identical = or - characters; the pair becomes one ATX line, # for an = underline and ## for a - underline. The flag is off unless it is passed and is not part of the make fmt flag set.

A candidate line is converted only when it is paragraph text. A line that is already a Markdown block start keeps its underline, so the line below it survives: an ATX heading, a thematic break, a list item, a blockquote, a footnote or link reference definition, a markdownlint directive, a fenced-code marker, or a table row.

A table delimiter row is refused too. It is table syntax rather than paragraph text, so the --- beneath it is a thematic break and not an underline, and the table above it keeps its alignment row. A line beginning with | is table syntax as well, so | Title above --- is not converted and the --- stays a thematic break.

Indentation and blockquote markers shared by the heading and its underline are preserved, so > Title above > ----- becomes > ## Title. The two lines may use different indentation of up to three spaces, provided they remain at the same blockquote depth.

A candidate indented by four or more columns, or one inside a blockquote and indented four or more columns after the marker, is an indented code block: it is left untouched, as is the line beneath it. Three columns or fewer still convert. Tabs count as four columns.