Variables and precedence
DocsLit resolves placeholders like {{NAME}} at compile time in prose.
Resolution order
From lowest to highest priority:
- global
attributesindocslit.json - page frontmatter
attributes - page-local
<wc-var name="X" value="Y" />
If the same key is defined more than once, the later layer overrides the earlier one.
Global variables
Define shared attributes in docslit.json:
Page-level overrides
Override on a page with frontmatter:
Or override locally in page body:
Built-in version variables
DocsLit injects these variables on every page:
{{DOCSLIT_VERSION}}— current docs version{{DOCSLIT_BRANCH}}— source branch for that version
For versioned docs, these values follow the active version/branch. For unversioned docs, they fall back to unversioned and working-tree.
Notes
- variable keys should use
UPPER_SNAKE_CASE - placeholders inside fenced code blocks are not substituted
- use
{{NAME}}when you want to show a placeholder literally in prose - use
<wc-var name="X" value="Y" />to show literal component syntax - use Reusable content for include-specific rules