html5validator
command-line HTML5 validation tool using the Nu Html Checker
TLDR
Validate an HTML file
$ html5validator [file.html]
Validate all HTML in directory$ html5validator --root [path/to/directory]
Show warnings$ html5validator --show-warnings [file.html]
Match custom file pattern$ html5validator --root [path] --match "*.html *.php"
Exclude directories$ html5validator --root [path] --blacklist "node_modules vendor"
Output as JSON$ html5validator --format json [file.html]
Ignore specific errors$ html5validator --ignore-re 'Attribute "ng-[a-z-]+" not allowed' [file.html]
SYNOPSIS
html5validator [options] [files]
DESCRIPTION
html5validator is a command-line HTML5 validation tool using the Nu Html Checker (v.Nu). Designed for static site generators and continuous integration. Returns exit code 0 for valid HTML. Requires Python 3.6+ and Java 8.
PARAMETERS
--root dir
Start directory for file search.--match pattern
File patterns to match (default *.html).--blacklist dirs
Directory names to skip.--show-warnings
Show warnings as errors.--format fmt
Output format: gnu, xml, json, text.--ignore-re regex
Ignore errors matching regex.--ignore message
Ignore errors that exactly match the given message.--also-check-css
Also validate CSS files (matches *.html and *.css by default).--config file
Read options from a configuration file.
INSTALL
nix profile install nixpkgs#html5validator
CAVEATS
Requires a working Java runtime (OpenJDK 8+) on the PATH, since it shells out to the bundled vnu.jar to perform the actual validation.
SEE ALSO
tidy(1)