Validation

CLI reference•3 min read|
|

The docslit validate command checks your project for common errors — broken links, missing pages, unknown components, and incomplete frontmatter.

Run validation

docslit validate

The output shows errors, warnings, and informational messages with colored indicators. Autogenerated sidebars are expanded before the checks run.

validate finds broken things. It does not judge quality. For that, run docslit lint.

Line numbers count from the first line of the file, including the frontmatter, so they match what your editor shows.

What gets checked

Check Level Description
Config file exists Error docslit.json must exist and parse as valid JSON
Sidebar structure Error The sidebar array must exist in the config
Page files exist Error Every slug in the sidebar must have a matching .md file in docs/
Internal links Error Links to other pages must point to valid page slugs
Asset references Error Markdown images and HTML img tags must point at an existing file, whether the path starts with /, ./, ../ or is a bare relative path like images/x.png. wc-image and wc-download paths are not checked
Code imports Error file= imports must find the file, region and line range. See Import code from files
Page titles Warning A page needs a title in its frontmatter or a # heading. The warning fires only when it has neither
Component tags Warning All wc-* tags must be built-in or defined in components/
Component markup Error or warning Unclosed, stray or malformed tags are errors. Unknown attributes, invalid attribute values, missing required attributes and bad nesting are warnings
Math Warning Formulas that KaTeX cannot parse. The build prints the same warning
Duplicate slugs Warning Each page slug should appear only once in the sidebar
Orphaned pages Info Markdown files in docs/ that are not listed in the sidebar. Pages with sidebar: false are skipped
Includes and variables Error or warning wc-include targets, wc-var names and undefined {{NAME}} placeholders
Frontmatter keys Info Keys that are not in the frontmatter schema
OpenAPI Error or warning Spec and overlay files exist, wc-endpoint ref values exist, and every operation is documented
Theme Error or warning The theme, palette, preset, appearance, strict and radius values must be valid, and a theme file must exist and parse. Typos get the nearest name. Explicit colors that fail WCAG AA contrast are warnings (theme-low-contrast). See Palettes and brand colors
Icons Warning An icon, icon-name, right-icon or wc-icon name that exists in neither Lucide nor Font Awesome Free (unknown-icon), with the nearest known name
Agent renditions Warning A docs/<id>.agent.md file needs a matching <id>.md (agent-rendition-orphaned). Fix: add the page, or delete the .agent.md file. See Conditional content
Agent skills Warning Each skills/<name>/SKILL.md must have a valid name that matches its folder and a description of 1 to 1024 characters, and be 1 MiB or smaller (skill-invalid). Fix: follow the naming rules
Redirect patterns Warning A bad pattern, a rest capture that isn't last, or a destination that uses a capture the source lacks (redirect-invalid). Fix: use sources like /old/:slug* and capture only what the destination uses
Redirect targets Warning An exact internal destination that isn't a known page or redirect source (redirect-target-missing). Fix: point it at an existing page or fix the path. See Redirects
Navigation Error or warning Tabs, anchors, navbar links, the logo, layout settings and contextual options in docslit.json, and page keys such as layout, toc_depth and tab in frontmatter. See Tabs and anchors

Strict mode

By default, validate exits with code 0 if there are only warnings. Use --strict to treat warnings as errors:

docslit validate --strict

This is useful in CI pipelines where you want to enforce documentation quality:

- run: npm install -g docslit - name: Validate docs run: docslit validate --strict --external --format github docslit validate --external

Checks http(s) links with HEAD (falls back to GET), 8s timeout, limited concurrency.

GitHub Actions annotations

docslit validate --format github

Prints ::error file=…,line=…::message so failures show inline on pull requests.

JSON output

docslit validate --format json

Prints one JSON document and nothing else, for AI agents and scripts:

{ "ok": false, "summary": { "errors": 1, "warnings": 0, "infos": 0, "pages": 3 }, "issues": [ { "level": "error", "code": "sidebar-missing-file", "message": "Sidebar slug \"missing-page\" has no matching file (looked for docs/missing-page.md)", "file": "docslit.json", "fix": "Create docs/missing-page.md or remove \"missing-page\" from the sidebar" } ] }

Each issue has a stable code, a message, a file, a line when it has one, and a fix when the validator knows one. The full list of codes is in Machine-readable CLI.

Exit codes

No errors found. Warnings may be present in non-strict mode. Errors found, or warnings found in strict mode.

Custom components and validation

The validator scans your components/ directory for customElements.define calls. Any <wc-*> tag that matches a custom component definition is treated as valid. Tags that are neither built-in nor custom trigger a warning.

Add docslit validate --strict to your CI pipeline to catch broken links and missing pages before they reach production.