Configuration presets

HTML-validate comes with a few predefined presets.

Presets can be configured in .htmlvalidate.json using:

{
  "extends": ["html-validate:PRESET"]
}

Multiple presets can be set and will be enabled in the order they appear in "extends". See configuration usage guide for more details.

Available presets

This is the default preset and enables most rules including standards validation, WCAG and best practices. It is a superset of the other presets.

html-validate:standard

Enables rules related to validating according to the WHATWG HTML standard (Living Standard).

Use this preset if you want validation similar to the Nu Html Checker and similar tools.

html-validate:a17y

Enables rules related to accessibility. Most rules but not all enabled rules relates to WCAG compliance. On its own it will not validate if the document/template itself is valid but only if accessibility issues can be found.

This preset should be used together with html-validate:standard to ensure the document structure is valid (a requirement of WCAG) and if possible html-validate:document (to ensure references are valid, etc).

html-validate:document

Enables rules requiring a full document to validate, i.e. not a partial template. Examples include missing doctype and invalid references.

Use this preset together with other presets for full coverage. This preset is enabled by plugins such as cypress-html-validate and protractor-html-validate.

Comparison

Rule recommended standard a17y document
allowed-links
aria-hidden-body
aria-label-misuse
attr-case
attr-delimiter
attr-pattern
attr-quotes
attr-spacing
attribute-allowed-values
attribute-boolean-style
attribute-empty-style
class-pattern
close-attr
close-order
deprecated
deprecated-rule
doctype-html
doctype-style
element-case
element-name
element-permitted-content
element-permitted-occurrences
element-permitted-order
element-required-ancestor
element-required-attributes
element-required-content
empty-heading
empty-title
heading-level
id-pattern
input-attributes
input-missing-label
long-title
meta-refresh
missing-doctype
multiple-labeled-controls
no-autoplay
no-conditional-comment
no-deprecated-attr
no-dup-attr
no-dup-class
no-dup-id
no-implicit-close
no-inline-style
no-missing-references
no-multiple-main
no-raw-characters
no-redundant-for
no-redundant-role
no-self-closing
no-style-tag
no-trailing-whitespace
no-unknown-elements
no-utf8-bom
prefer-button
prefer-native-element
prefer-tbody
require-csp-nonce
require-sri
script-element
script-type
svg-focusable
tel-non-breaking
text-content
unrecognized-char-ref
valid-id
void
void-content
void-style
wcag/h30
wcag/h32
wcag/h36
wcag/h37
wcag/h67
wcag/h71