# The Nu Html Checker (v.Nu) [![Chat room][1]][2] [![Download latest][3]][4] [1]: https://img.shields.io/badge/[matrix]-chat%20%E2%86%92-brightgreen.svg [2]: https://matrix.to/#/#validator_validator:gitter.im [3]: https://img.shields.io/badge/download-latest%20%E2%86%92-blue.svg [4]: https://github.com/validator/validator/releases/latest The Nu Html Checker (v.Nu) helps you [catch unintended mistakes in your HTML, CSS, and SVG][5]. It enables you to [batch-check documents from the command line][6] and from other scripts/apps, and to [deploy your own instance of the checker as a service][7] (like [validator.w3.org/nu][8]). Its [source code is available][9], as are [instructions on how to build, test, and run the code][10]. [5]: https://validator.w3.org/nu/about.html#why-validate [6]: https://validator.github.io/validator/#usage [7]: https://validator.github.io/validator/#standalone [8]: https://validator.w3.org/nu/ [9]: https://github.com/validator/validator [10]: https://validator.github.io/validator/#build-instructions `vnu.jar` is a packaged version of the Nu Html Checker for batch-checking documents from the command line and from other scripts/apps. You can work with `vnu.jar` in CommonJS modules. ## Install latest release version ```sh npm install --save vnu-jar ``` ## Install 'next' version ```sh npm install --save vnu-jar@next ``` ## Example For Node.js 6+ ```js 'use strict'; const exec = require('child_process').exec; const vnu = require('vnu-jar'); // Print path to vnu.jar console.log(vnu); // Work with vnu.jar // for example get vnu.jar version exec(`java -jar ${vnu} --version`, (error, stdout) => { if (error) { console.error(`exec error: ${error}`); return; } console.log(stdout); }); ``` ## Usage Run the checker with one of the following invocations: • `vnu-runtime-image/bin/vnu OPTIONS FILES` (Linux or macOS) • `vnu-runtime-image\bin\vnu.bat OPTIONS FILES` (Windows) • `java -jar ~/vnu.jar OPTIONS FILES` (any system with Java8+ installed) …where _`FILES`_ are the documents to check, and _`OPTIONS`_ are zero or more of the following options: --errors-only --Werror --exit-zero-always --stdout --asciiquotes --user-agent USER_AGENT --no-langdetect --no-stream --filterfile FILENAME --filterpattern PATTERN --css --skip-non-css --also-check-css --svg --skip-non-svg --also-check-svg --html --skip-non-html --format gnu|xml|json|text --help --verbose --version The [Options][27] section below provides details on each option, and the rest of this section provides some specific examples. [27]: https://validator.github.io/validator/#options **Note:** Throughout these examples, replace `~/vnu.jar` with the actual path to that jar file on your system, and replace `vnu-runtime-image/bin/vnu` and `vnu-runtime-image\bin\vnu.bat` with the actual path to the `vnu` or `vnu.bat` program on your system — or if you add the `vnu-runtime-image/bin` or `vnu-runtime-image\bin` directory your system `PATH` environment variable, you can invoke the checker with just `vnu`. To check one or more documents from the command line: vnu-runtime-image/bin/vnu FILE.html FILE2.html FILE3.html... vnu-runtime-image\bin\vnu.bat FILE.html FILE2.html FILE3.html... java -jar ~/vnu.jar FILE.html FILE2.html FILE3.html... **Note:** If you get a `StackOverflowError` error when invoking the checker, try adjusting the thread stack size by providing the `-Xss` option to java: java -Xss512k -jar ~/vnu.jar ... vnu-runtime-image/bin/java -Xss512k \ -m vnu/nu.validator.client.SimpleCommandLineValidator ... To check all documents in a particular directory `DIRECTORY_PATH` as HTML: java -jar ~/vnu.jar DIRECTORY_PATH vnu-runtime-image/bin/vnu DIRECTORY_PATH vnu-runtime-image\bin\vnu.bat DIRECTORY_PATH #### More examples **Note:** The examples in this section assume you have the `vnu-runtime-image/bin` or `vnu-runtime-image\bin` directory in your system `PATH` environment variable. If you’re using the jar file instead, replace `vnu` in the examples with `java -jar ~/vnu.jar`. To check all documents in a particular directory `DIRECTORY_PATH` as HTML, but skip any documents whose names don’t end with the extensions `.html`, `.htm`, `.xhtml`, or `.xht`: vnu --skip-non-html DIRECTORY_PATH To check all documents in a particular directory as CSS: vnu --css DIRECTORY_PATH To check all documents in a particular directory as CSS, but skip any documents whose names don’t end with the extension `.css`: vnu --skip-non-css DIRECTORY_PATH To check all documents in a particular directory, with documents whose names end in the extension `.css` being checked as CSS, and all other documents being checked as HTML: vnu --also-check-css DIRECTORY_PATH To check all documents in a particular directory as SVG: vnu --svg DIRECTORY_PATH To check all documents in a particular directory as SVG, but skip any documents whose names don’t end with the extension `.svg`: vnu --skip-non-svg DIRECTORY_PATH To check all documents in a particular directory, with documents whose names end in the extension `.svg` being checked as SVG, and all other documents being checked as HTML: vnu --also-check-svg DIRECTORY_PATH To check a Web document: vnu _URL_ example: vnu http://example.com/foo To check standard input: vnu - example: echo '