Skip to content

Output

mddocslint prints its results and then ends with an exit code, a number that tells scripts and CI systems whether the run passed. What you see depends on that code.

To see the exit code of the last command:

  • PowerShell:

    $LASTEXITCODE
  • Git Bash, macOS, and Linux:

    echo $?
  • Command Prompt:

    echo %ERRORLEVEL%
Exit codeMeaningCommon causes
0Clean. The Markdown files passed every rule that ran.None.
1Problems found. At least one rule reported a problem.The files have problems and broken rules.
2Usage error. The command couldn’t run.A PATH that does not exist, a folder with no .md files, a misspelled rule name, an invalid --format value, an unknown flag, or no PATH at all.

mddocslint prints nothing. Silence means no rule has been broken.

Exit code 1 means mddocslint worked and found problems in your file(s).

mddocslint prints one line for each problem, and a summary line at the end:

docs/guide/setup.md:1:1: front-matter[missing] file does not start with a '---' front matter block
docs/guide/setup.md:3:1: heading-jumps[skipped-level] heading jumps from H1 to H3; the next level down is H2
docs/guide/setup.md:5:20: broken-links[missing-file] link target 'guide/missing.md' does not exist
3 problem(s) in 1 file(s)

Each problem line follows the same pattern:

path:line:column: rule[kind] message
PartMeaning
pathThe file that has the problem.
line:columnWhere the problem is in that file. Both numbers start at 1.
ruleThe rule that found it: front-matter, heading-jumps, or broken-links. See the rules reference.
kindThe specific type of problem within that rule, such as missing or skipped-level. See the rules reference for more information on the kinds of rule breaks.
messageA plain-language description of what’s wrong.

Problems are sorted by file, then by line. The last line is a summary of the total number of problems and the number of files that have them.

For machine-readable output, use --format json (see —format).

Exit code 2 means mddocslint could not do its job because of the command you typed. Scripts and CI jobs usually treat any non-zero code as a failure, and they can use the number to tell the two cases apart.

The command itself is wrong, so mddocslint does not lint anything. It prints the correct syntax and a reason:

mddocslint missing-folder
usage: mddocslint [-h] [--rules RULES] [--ignore RULES] [--format {text,json}] [-q] [--version] PATH [PATH ...]
mddocslint: error: path not found: missing-folder