Dark modeNederlands

Accessibility validator

Checks HTML content against the content guidelines of NL Design System: headings, paragraphs, lists, links, images, tables and description lists. Each issue comes with a link to the guideline and, where the fix is unambiguous, a correction the validator can apply itself.

The validator checks content in the editor while an author writes, and runs from the command line against published HTML.

Installation

npm install @nl-design-system-community/clippy-a11y-validator

The command line tool parses each document with happy-dom, so it needs no browser. Scripts in a document don't run: it validates the HTML as written.

Browser

Check part of the page in the browser. Every violation points at the element itself:

import { coreValidations, Validator } from '@nl-design-system-community/clippy-a11y-validator';

const validator = new Validator({ validations: Object.values(coreValidations) });
const violations = validator.validate([document.querySelector('main')]);

Command line

npx clippy-validate-html <path...> [options]

Each path is an .html or .htm file, or a directory to search for them.

OptionDescription
--allow-warningsExit with 0 when no issues of error severity are found.
--diffShow a suggestion for how to fix each validation issue. When several corrections are possible, select the one you want from a list. The fix is shown, but never overwrites the source file.
--skip <selector>Remove everything matching this CSS selector before validating, e.g. demo markup that is wrong on purpose. Repeat the option for more selectors.
--help, -hShow the usage.

Validations

You can find every rule with examples in the validations.