1.1 KiB
MD043 - Required header structure
Tags: headers
Aliases: required-headers
Parameters: headers (array of string; default null for disabled)
This rule is triggered when the headers in a file do not match the array of headers passed to the rule. It can be used to enforce a standard header structure for a set of files.
To require exactly the following structure:
# Head
## Item
### Detail
Set the headers parameter to:
[
"# Head",
"## Item",
"### Detail"
]
To allow optional headers as with the following structure:
# Head
## Item
### Detail (optional)
## Foot
### Notes (optional)
Use the special value "*" meaning "one or more unspecified headers" and set
the headers parameter to:
[
"# Head",
"## Item",
"*",
"## Foot",
"*"
]
When an error is detected, this rule outputs the line number of the first problematic header (otherwise, it outputs the last line number of the file).
Note that while the headers parameter uses the "## Text" ATX header style for
simplicity, a file may use any supported header style.