The Nu Markup Checker (v.Nu) is a name for the backend of html5.validator.nu, validator.w3.org/nu, and the HTML5 facet of the legacy W3C Validator. Its source code is available from a set of github repositories. The checker is released as two separate packages:
-
vnu.jaris a portable standalone version for batch-checking documents from the command line and from other scripts/apps, or for deploying the checker as a self-contained service -
vnu.waris for deploying the checker service through a servlet container such as Tomcat
To use the Nu Markup Checker on your own, get the latest release and see the Usage section below— or alternatively, consider automating your HTML checking with a frontend such as:
-
HTML5 Validator Integration for Travis CI (auto-check documents pushed to a github repo)
-
LMVTFY: Let Me Validate That For You (auto-check HTML of JSFiddle/JSBin etc. links in github issue comments)
You can use the vnu.jar markup checker as an executable for command-line
checking of HTML documents by invoking it like this:
java -jar ~/vnu.jar [--errors-only] [--no-stream]
[--format gnu|xml|json|text] [--help] [--html] [--verbose]
[--version] FILES
Note: In these instructions, replace "~/vnu.jar" with the actual path to the file on your system.
To check one or more HTML documents from the command line:
java -jar ~/vnu.jar FILE.html FILE2.html FILE3.HTML FILE4.html...
Note: If you get a StackOverflowError error when using the vnu.jar file,
try adjusting the thread stack size by providing the -Xss option to java:
java -Xss512k -jar ~/vnu.jar FILE.html...
To check all HTML documents in a particular directory:
java -jar ~/vnu.jar some-directory-name/
To check a Web document:
java -jar ~/vnu.jar _URL_
example: java -jar ~/vnu.jar http://example.com/foo
To check standard input:
java -jar ~/vnu.jar -
example: echo '<!doctype html><title>...' | java -jar ~/vnu.jar -
When used from the command line as described in this section, the vnu.jar
executable provides the following options:
Specifies that only error-level messages and non-document-error messages are
reported (so that warnings and info messages are not reported).
default: [unset; all message reported, including warnings & info messages]
Specifies the output format for reporting the results.
default: "gnu"
possible values: "gnu", "xml", "json", "text"
see also:
[wiki.whatwg.org/wiki/Validator.nu_Common_Input_Parameters#out][12]
Shows detailed usage information.
Forces all documents to be parsed by the HTML parser, as text/html
(otherwise, *.xhtml documents are parsed using an XML parser).
default: [unset; *.xhtml documents are parsed using an XML parser]
Forces all documents to be be parsed in buffered mode instead of streaming
mode (causes some parse errors to be treated as non-fatal document errors
instead of as fatal document errors).
default: [unset; non-streamable parse errors cause fatal document errors]
Specifies "verbose" output. (Currently this just means that the names of
files being checked are written to stdout.)
default: [unset; output is not verbose]
Shows the vnu.jar version number.