Lint
docslit lint checks whether your docs are good, not whether they are broken. validate finds broken links and unknown components. lint finds pages that are hard to read, hard to search, or hard for an AI tool to retrieve.
pretty, json or github (Actions annotations). Any other value exits with code 1. See Machine-readable CLI for the JSON shape.The optional first argument is the project directory. The linter reads every .md and .mdx file under docs/, plus the docs.<locale>/ folders of an i18n site. Files under docs/_reusables/ are checked only by rules that apply to any content.
A page that passes looks like this:
Rules
Every rule has a level of info, warning or error. No rule is an error by default, so lint fails only with --strict or after you raise a rule.
| Rule | Default | Checks |
|---|---|---|
missing-description |
warning | The frontmatter description is absent or empty |
description-length |
info | The description is shorter than 30 or longer than 200 characters |
title-h1-mismatch |
info | The frontmatter title differs from the first H1 |
multiple-h1 |
warning | More than one H1 on a page |
heading-skip |
warning | A heading level is skipped, such as ## followed by #### |
duplicate-heading |
warning | The same heading text appears twice under one parent, which makes anchors ambiguous |
code-no-language |
warning | A fenced code block or wc-code-block has no language |
image-missing-alt |
warning | An image has no alt text |
link-text-vague |
warning | Link text such as "click here" or a bare URL |
page-too-long |
warning | More than 2500 words of prose |
page-too-short |
info | Fewer than 30 words of prose |
empty-section |
warning | A heading with no content before the next heading |
todo-marker |
warning | TODO, FIXME, TBD or lorem ipsum left in prose |
raw-html-block |
info | Raw div, span, table or details HTML where Markdown or a component exists |
callout-overuse |
info | More than 5 callouts on a page |
long-paragraph |
info | A paragraph longer than 150 words |
Code blocks, inline code, frontmatter and HTML comments are ignored. The short-page rule skips API pages and pages built from tiles, cards or includes.
Configure rules
Add a lint block to docslit.json. A rule can be "off", a level, or an object with a level and a number:
The numeric options are min and max, and only some rules use them: description-length (min, max), page-too-long (max), page-too-short (min), callout-overuse (max) and long-paragraph (max). An unknown rule name or a bad value is reported as a lint-config-invalid warning. The docslit schema JSON Schema covers this block, so your editor can complete the rule names.
Disable rules in a page
Use HTML comments, which readers never see. They are ignored inside code, so they must be real comments in the page body:
That line turns off the listed rules for the whole file. With no rule names it turns off all rules for the file. To skip one line, put this on the line before it:
Fixing findings
lint has no auto-fix, because no rule has a fix that is always safe, and it has no --fix option (passing one is an error). Each issue includes a fix sentence that says what to change.
Run lint together with validate in CI: