The Nu Html Checker (v.Nu) (2023)

Note: The vnu.jar and vnu.war files require you to have Java 8 or above installed. The pre-compiled Linux, Windows, and macOS binaries don’t require you to have any version of Java already installed at all.

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-agentUSER_AGENT --no-langdetect--no-stream --filterfileFILENAME --filterpatternPATTERN--css --skip-non-css --also-check-css--svg --skip-non-svg --also-check-svg--xml --html --skip-non-html --formatgnu|xml|json|text--help --verbose --version

The Options section below provides details on each option, and the rest of this section provides some specific examples.

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:

(Video) Checking the Validity of HTML files using the NU HTML checker.

 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:

(Video) How To Error Check (Validate) HTML Code With Nu HTML Checker

 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 '<!doctype html><title>...' | vnu -
echo '<!doctype html><title>...' | java -jar ~/vnu.jar -

Options

When used from the command line as described in this section, the checker provides the following options:

--asciiquotes

Specifies whether ASCII quotation marks are substituted for Unicodesmart quotation marks in messages.default: [unset; Unicode smart quotation marks are used in messages]

--errors-only

Specifies that only error-level messages and non-document-error messagesare reported (so that warnings and info messages are not reported).default: [unset; all messages reported, including warnings & info messages]

--Werror

Makes the checker exit non-zero if any warnings are encountered (even ifthere are no errors).default: [unset; checker exits zero if only warnings are encountered]

--exit-zero-always

Makes the checker exit zero even if errors are reported for any documents.default: [unset; checker exits 1 if errors are reported for any documents]

--stdout

Makes the checker report errors and warnings to stdout rather than stderr.default: [unset; checker reports errors and warnings to stderr]

--filterfile FILENAME

Specifies a filename. Each line of the file contains either a regularexpression or starts with "#" to indicate the line is a comment. Any errormessage or warning message that matches a regular expression in the file isfiltered out (dropped/suppressed).default: [unset; checker does no message filtering]

--filterpattern REGEXP

Specifies a regular expression. Any error message or warning message thatmatches the regular expression is filtered out (dropped/suppressed).As with all other checker options, this option may only bespecified once. So to filter multiple error messages or warning messages,you must provide a single regular expression that will match all themessages. The typical way to do that for regular expressions is to ORmultiple patterns together using the "|" character.default: [unset; checker does no message filtering]

--format format

Specifies the output format for reporting the results.default: "gnu"possible values: "gnu", "xml", "json", "text" [see information at URL below]https://github.com/validator/validator/wiki/Service-%C2%BB-Common-params#out

--help

Shows detailed usage information.

--skip-non-css

Check documents as CSS but skip documents that don’t have *.css extensions.default: [unset; all documents found are checked]

--css

Force all documents to be checked as CSS, regardless of extension.default: [unset]

--skip-non-svg

Check documents as SVG but skip documents that don’t have *.svg extensions.default: [unset; all documents found are checked]

--svg

Force all documents to be checked as SVG, regardless of extension.default: [unset]

--skip-non-html

Skip documents that don’t have *.html, *.htm, *.xhtml, or *.xht extensions.default: [unset; all documents found are checked, regardless of extension]

--html

Forces any *.xhtml or *.xht documents to be parsed using the HTML parser.default: [unset; XML parser is used for *.xhtml and *.xht documents]

--xml

Forces any *.html documents to be parsed using the XML parser.default: [unset; HTML parser is used for *.html documents]

--also-check-css

Check CSS documents (in addition to checking HTML documents).default: [unset; no documents are checked as CSS]

--also-check-svg

Check SVG documents (in addition to checking HTML documents).default: [unset; no documents are checked as SVG]

--user-agent USER_AGENT

Specifies the value of the User-Agent request header to send whenchecking HTTPS/HTTP URLs.default: "Validator.nu/LV"

--no-langdetect

Disables language detection, so that documents are not checked for missingor mislabeled html[lang] attributes.default: [unset; language detection & html[lang] checking are performed]

--no-stream

Forces all documents to be be parsed in buffered mode instead of streamingmode (causes some parse errors to be treated as non-fatal document errorsinstead of as fatal document errors).default: [unset; non-streamable parse errors cause fatal document errors]

--verbose

Specifies "verbose" output. (Currently this just means that the names offiles being checked are written to stdout.)default: [unset; output is not verbose]

--version

Shows the checker version number.

The Nu Html Checker — along with being usable as a standalone command-line client — can be run as an HTTP service, similar to validator.w3.org/nu, for browser-based checking of HTML documents, CSS stylesheets, and SVG images over the Web. To that end, the checker is released as several separate packages:

All deployments expose a REST API that enables checking of HTML documents, CSS stylesheets, and SVG images from other clients, not just web browsers. And the Linux, Windows, and macOS binaries and vnu.jar package also include a simple HTTP client that enables you to either send documents to a locally-running instance of the checker HTTP service — for fast command-line checking — or to any remote instance of the checker HTTP service running anywhere on the Web.

Note:Throughout these instructions, replace ~/vnu.jar with the actual path to that jar file on your system, and replace vnu-runtime-image/bin/java and vnu-runtime-image\bin\java.exe with the actual path to the checker java or java.exe 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 javanu.validator.servlet.Main 8888.

Standalone web server

To run the checker as a standalone service (using a built-in Jetty server), open a new terminal window and invoke the checker like this:

java -cp ~/vnu.jar nu.validator.servlet.Main 8888
vnu-runtime-image/bin/java nu.validator.servlet.Main 8888
vnu-runtime-image\bin\java.exe nu.validator.servlet.Main 8888

Then open http://0.0.0.0:8888 in a browser. (To listen on a different port, replace 8888 with the port number.)

Warning: Future checker releases will bind by default to the address 127.0.0.1. Your checker deployment might become unreachable unless you use the nu.validator.servlet.bind-address system property to bind the checker to a different address:

java -cp ~/vnu.jar \ -Dnu.validator.servlet.bind-address=128.30.52.73 \ nu.validator.servlet.Main 8888
vnu-runtime-image/bin/java \ -Dnu.validator.servlet.bind-address=128.30.52.73 \ nu.validator.servlet.Main 8888
vnu-runtime-image\bin\java.exe \ -Dnu.validator.servlet.bind-address=128.30.52.73 \ nu.validator.servlet.Main 8888

When you open http://0.0.0.0:8888 (or whatever URL corresponds to the nu.validator.servlet.bind-address value you’re using), you’ll see a form similar to validator.w3.org/nu that allows you to enter the URL of an HTML document, CSS stylesheet, or SVG image, and have the results of checking that resource displayed in the browser.

Note: If you get a StackOverflowError error when using the checker, try adjusting the thread stack size by providing the -Xss option to java:

 java -Xss512k -cp ~/vnu.jar nu.validator.servlet.Main 8888
 vnu-runtime-image/bin/java -Xss512k -m vnu/nu.validator.servlet.Main 8888

Deployment to servlet container

To run the checker inside of an existing servlet container such as Apache Tomcat you will need to deploy the vnu.war file to that server following its documentation. For example, on Apache Tomcat you could do this using the Manager application or simply by copying the file to the webapps directory (since that is the default appBase setting). Typically you would see a message similar to the following in the catalina.out log file.

May 7, 2014 4:42:04 PM org.apache.catalina.startup.HostConfig deployWARINFO: Deploying web application archive /var/lib/tomcat7/webapps/vnu.war

Assuming your servlet container is configured to receive HTTP requests sent to localhost on port 80 and the context root of this application is vnu (often the default behavior is to use the WAR file's filename as the context root unless one is explicitly specified) you should be able to access the application by connecting to http://localhost/vnu/.

(Video) HTML : HTML5 Validating with Nu Html Checker

Note: You may want to customize the /WEB-INF/web.xml file inside the WAR file (you can use any ZIP-handling program) to modify the servlet filter configuration. For example, if you wanted to disable the inbound-size-limit filter, you could comment out that filter like this:

<!-- <filter> <filter-name>inbound-size-limit-filter</filter-name> <filter-class>nu.validator.servlet.InboundSizeLimitFilter</filter-class> </filter> <filter-mapping> <filter-name>inbound-size-limit-filter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping>-->

HTTP client (for fast command-line checking)

The checker is packaged with an HTTP client you can use from the command line to either send documents to a locally-running instance of the checker HTTP service — for fast command-line checking — or to a remote instance anywhere on the Web.

To check documents locally using the packaged HTTP client, do this:

  1. Start up the checker as a local HTTP service, as described in the Standalone web server section.
  2. Open a new terminal window and invoke the HTTP client like this:
    java -cp ~/vnu.jar nu.validator.client.HttpClient FILE.html...
    vnu-runtime-image/bin/java nu.validator.client.HttpClient FILE.html...
To send documents to an instance of the checker on the Web, such as html5.validator.nu/, use the nu.validator.client.host and nu.validator.client.port options, like this:
java -cp ~/vnu.jar -Dnu.validator.client.port=80 \ -Dnu.validator.client.host=html5.validator.nu \ nu.validator.client.HttpClient FILE.html...
…or like this:
vnu-runtime-image/bin/java -Dnu.validator.client.port=80 \ -Dnu.validator.client.host=html5.validator.nu \ nu.validator.client.HttpClient FILE.html...

Other options are documented below.

HTTP client options

When using the packaged HTTP client for sending documents to an instance of the checker HTTP service for checking, you can set Java system properties to control configuration options for the checker behavior.

For example, you can suppress warning-level messages and only show error-level ones by setting the value of the nu.validator.client.level system property to error, like this:

java -Dnu.validator.client.level=error \ -cp ~/vnu.jar nu.validator.client.HttpClient FILE.html...
…or like this:
vnu-runtime-image/bin/java -Dnu.validator.client.level=error \ -cp ~/vnu.jar nu.validator.client.HttpClient FILE.html...

Most of the properties listed below map to the common input parameters for the checker service, as documented at github.com/validator/validator/wiki/Service-»-Common-params.

nu.validator.client.host

Specifies the hostname of the checker for the client to connect to.default: "127.0.0.1"

nu.validator.client.port

Specifies the hostname of the checker for the client to connect to.default: "8888"example: java -Dnu.validator.client.port=8080 -jar ~/vnu.jar FILE.html

nu.validator.client.level

Specifies the severity level of messages to report; tosuppress warning-level messages, and only show error-level ones, setthis property to "error".default: [unset]possible values: "error"example: java -Dnu.validator.client.level=error -jar ~/vnu.jar FILE.html

nu.validator.client.parser

Specifies which parser to use.default: "html"; or, for *.xhtml input files, "xml"possible values: [see information at URL below]https://github.com/validator/validator/wiki/Service-%C2%BB-Common-params#parser

nu.validator.client.charset

Specifies the encoding of the input document.default: [unset]

nu.validator.client.content-type

Specifies the content-type of the input document.default: "text/html"; or, for *.xhtml files, "application/xhtml+xml"

nu.validator.client.out

Specifies the output format for messages.default: "gnu"possible values: [see information at URL below]https://github.com/validator/validator/wiki/Service-%C2%BB-Common-params#out

nu.validator.client.asciiquotes

Specifies whether ASCII quotation marks are substituted for Unicodesmart quotation marks in messages.default: "yes"possible values: "yes" or "no"

HTTP servlet options

nu.validator.servlet.bind-address

Binds the validator service to the specified IP address.default: 0.0.0.0 [causes the checker to listen on all interfaces]possible values: The IP address of any network interfaceexample: -Dnu.validator.servlet.bind-address=127.0.0.1

nu.validator.servlet.connection-timeout

Specifies the connection timeout.default: 5000possible values: number of millisecondsexample: -Dnu.validator.servlet.connection-timeout=5000

nu.validator.servlet.socket-timeout

Specifies the socket timeout.default: 5000possible values: number of millisecondsexample: -Dnu.validator.servlet.socket-timeout=5000
(Video) Nu Html Checker

Videos

1. Lil Nas X, Jack Harlow - INDUSTRY BABY (Official Video)
(Lil Nas X)
2. How To Validate HTML - Using an HTML Validator
(Ken Swartwout)
3. If You’re Happy And You Know It | Kids Songs | Super Simple Songs
(Super Simple Songs - Kids Songs)
4. Tim Urban: Inside the mind of a master procrastinator | TED
(TED)
5. Chimamanda Ngozi Adichie: The danger of a single story | TED
(TED)
6. Wendy Pretend Play Learn Colors with Kinetic Sand Rainbow Ice Cream Kid Toys
(Toys and Colors)
Top Articles
Latest Posts
Article information

Author: Geoffrey Lueilwitz

Last Updated: 02/02/2023

Views: 5830

Rating: 5 / 5 (60 voted)

Reviews: 83% of readers found this page helpful

Author information

Name: Geoffrey Lueilwitz

Birthday: 1997-03-23

Address: 74183 Thomas Course, Port Micheal, OK 55446-1529

Phone: +13408645881558

Job: Global Representative

Hobby: Sailing, Vehicle restoration, Rowing, Ghost hunting, Scrapbooking, Rugby, Board sports

Introduction: My name is Geoffrey Lueilwitz, I am a zealous, encouraging, sparkling, enchanting, graceful, faithful, nice person who loves writing and wants to share my knowledge and understanding with you.