Documentation testing
The Home Assistant documentation repository tests documentation changes with GitHub Actions.
For the current workflow, see test.yml.
The workflow runs two lint jobs:
- Lint Markdown checks Markdown structure and formatting with remark.
- Lint Text checks spelling, terminology, and wording with textlint.
The workflow also checks that integration pages in source/_integrations use the .markdown file extension instead of .md.
Running the tests locally
Install the Node.js dependencies in the home-assistant.io repository:
npm install
Then run the same commands used by CI:
npm run markdown:lint
npm run textlint
The commands are defined in package.json.
Markdown checks
The Markdown checks use remark in CI.
The markdown:lint script runs:
remark --quiet --frail .
The remark rules are defined in .remarkrc.js.
The configuration includes checks for code block hygiene, heading hygiene, list consistency, and prohibited strings.
Files and directories ignored by remark are listed in .remarkignore.
Adding a remark rule
To add a Markdown rule:
- Install the remark lint rule package with
npm install --save-dev <package-name>. This updatespackage.jsonandpackage-lock.json. - Enable and configure the rule in
.remarkrc.js. - Run
npm run markdown:lint. - Fix existing violations or add justified exclusions to
.remarkignore.
Text checks
The text checks use textlint.
The textlint script checks selected documentation directories, including:
source/_docssource/_faqsource/_integrationssource/_dashboardssource/cloudsource/getting-startedsource/hassiosource/dashboards
The textlint rules are defined in .textlintrc.json.
The configuration currently uses:
common-misspellingsfor common spelling mistakes.terminologyfor product names, preferred terms, and wording replacements.commentsso contributors can disable textlint for a specific section when needed.allowlistfor text that should be ignored by textlint.
Adding terminology entries
Add terminology entries to the terminology rule's terms list in .textlintrc.json.
Use a string for an accepted term that must keep its spelling or capitalization:
"Home Assistant",
"Z-Wave",
"GitHub"
Use a substitution pair to flag one spelling or phrase and suggest another:
["addon", "add-on"],
["Github", "GitHub"],
["repo\\b", "repository"]
The first value in a substitution pair is the textlint pattern to match. The second value is the suggested replacement shown to contributors. Escape characters that have special meaning in JSON or regular expressions.
Keep new entries close to related existing entries.
After changing terminology, run npm run textlint in the home-assistant.io repository.
Disabling textlint inline
For a false positive, you can disable textlint with HTML comments around the affected text:
<!-- textlint-disable -->
Text that textlint should ignore.
<!-- textlint-enable -->
To disable only one rule, add the rule name:
<!-- textlint-disable terminology -->
Text that textlint should ignore for this rule.
<!-- textlint-enable terminology -->
Keep inline disables as narrow as possible. Put a blank line before and after textlint comments unless doing so would break the surrounding Markdown structure. Do not put these comments inside Liquid text boxes.
Adding a textlint rule
To add a text rule:
- Add the textlint rule package to
package.jsonand updatepackage-lock.json. - Enable and configure the rule in
.textlintrc.json. - Run
npm run textlint. - Fix existing violations or add narrow exclusions to the
allowlistsection of.textlintrc.json.
Markdownlint configuration
The repository has a .markdownlint.json file.
This file defines markdownlint-compatible settings, for example disabling the line length rule and allowing inline HTML.
The recommended VS Code extensions include markdownlint in .vscode/extensions.json, so contributors may see markdownlint warnings in their editor.
Markdownlint is not run by the current GitHub Actions test workflow or the package.json scripts.
If you add or change markdownlint rules, also add a script and CI step if the rule must be enforced for pull requests.