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 togeher 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.

Comparision

Rule recommended standard a17y document
attr-case
attr-quotes
attribute-allowed-values
attribute-boolean-style
attribute-empty-style
class-pattern
close-attr
close-order
deprecated
deprecated-rule
doctype-html
element-case
element-name
element-permitted-content
element-permitted-occurrences
element-permitted-order
element-required-attributes
element-required-content
empty-heading
empty-title
heading-level
id-pattern
input-missing-label
long-title
meta-refresh
missing-doctype
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-raw-characters
no-redundant-role
no-self-closing
no-style-tag
no-trailing-whitespace
no-unknown-elements
prefer-button
prefer-native-element
prefer-tbody
require-sri
script-element
script-type
svg-focusable
unrecognized-char-ref
void
void-content
void-style
wcag/h30
wcag/h32
wcag/h36
wcag/h37
wcag/h67
wcag/h71