npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

vnu-jar-master

v18.4.8

Published

Provides the Nu Html Checker «vnu.jar» file from the master branch

Downloads

7

Readme

The Nu Html Checker (v.Nu) Chat room Download latest

The Nu Html Checker (v.Nu) is the backend of checker.html5.org, html5.validator.nu, and validator.w3.org/nu. Its source code is available, as are instructions on how to build, test, and run the code. A Dockerfile (see the Pulling from Docker Hub section below) and npm, pip, and brew packages of it are also available, and it’s released upstream in these formats:

Note: The vnu.jar and vnu.war files require a Java 8 environment; they won’t run in Java 7 or older environment.

This fork publishes a new vnu-jar-master NPM module, which is built from the master branch. It is supposed to be newer, than vnu-jar and vnu-jar@dev, if you need to detect more problems in your HTML, than the released or development versions can today.

You can get the latest release or run docker run -p 8888:8888 validator/validator:latest, npm install vnu-jar-master, brew install vnu, or pip install html5validator and see the Usage and Web-based checking sections below. Or automate your document checking with a frontend such as:

Usage

Use the vnu.jar checker as an executable for command-line checking of documents by invoking it like this:

  java -jar ~/vnu.jar [--errors-only] [--Werror] [--exit-zero-always]
       [--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] FILES

Note: In these instructions, replace "~/vnu.jar" with the actual path to the file on your system.

To check one or more 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 documents in a particular directory as HTML:

  java -jar ~/vnu.jar some-directory-name/

To check all documents in a particular directory as HTML, but skip any documents whose names don’t end with the extensions .html, .htm, .xhtml, or .xht:

  java -jar ~/vnu.jar --skip-non-html some-directory-name/

To check all documents in a particular directory as CSS:

  java -jar ~/vnu.jar --force-css some-directory-name/

To check all documents in a particular directory as CSS, but skip any documents whose names don’t end with the extension .css:

  java -jar ~/vnu.jar --skip-non-css some-directory-name/

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:

  java -jar ~/vnu.jar --also-check-css some-directory-name/

To check all documents in a particular directory as SVG:

  java -jar ~/vnu.jar --force-svg some-directory-name/

To check all documents in a particular directory as SVG, but skip any documents whose names don’t end with the extension .svg:

  java -jar ~/vnu.jar --skip-non-svg some-directory-name/

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:

  java -jar ~/vnu.jar --also-check-svg 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 -

Options

When used from the command line as described in this section, the vnu.jar executable provides the following options:

--asciiquotes

Specifies whether ASCII quotation marks are substituted for Unicode smart
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 messages are
reported (so that warnings and info messages are not reported).

default: [unset; all message reported, including warnings & info messages]

--Werror

Makes the checker exit non-zero if any warnings are encountered (even if
there 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]

--filterfile FILENAME

Specifies a filename. Each line of the file contains either a regular
expression or starts with "#" to indicate the line is a comment. Any error
message or warning message that matches a regular expression in the file is
filtered out (dropped/suppressed).

default: [unset; checker does no message filtering]

--filterpattern REGEXP

Specifies a regular expression. Any error message or warning message that
matches the regular expression is filtered out (dropped/suppressed).

As with all other vnu.jar options, this option may only be specified once.
So to filter multiple error messages or warning messages, you must provide a
single regular expression that will match all the messages. The typical way
to do that for regular expressions is to OR multiple 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]

--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 when checking
HTTPS/HTTP URLs.

default: "Validator.nu/LV"

--no-langdetect

Disables language detection, so that documents are not checked for missing
or 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 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]

--verbose

Specifies "verbose" output. (Currently this just means that the names of
files being checked are written to stdout.)

default: [unset; output is not verbose]

--version

Shows the vnu.jar version number.

Web-based checking with vnu.war or vnu.jar

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

  • vnu.jar for deploying the checker as a simple self-contained service
  • vnu.war for deploying the checker to a servlet container such as Tomcat

Both deployments expose a REST API that enables checking of HTML documents from other clients, not just web browsers. And the vnu.jar package also includes 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.

The latest releases of the vnu.jar and vnu.war packages are available from this fork of the validator project at github. The following are detailed instructions on using them.

Note: Replace "~/vnu.jar" or "~/vnu.war" below with the actual paths to those files on your system.

Standalone web server

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

    java -cp ~/vnu.jar nu.validator.servlet.Main 8888

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

You’ll see a form similar to validator.w3.org/nu that allows you to enter the URL of an HTML document and have the results for that document displayed in the browser.

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 -cp ~/vnu.jar 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 deployWAR
INFO: 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/.

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)

You can also use vnu.jar 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, 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 vnu.jar like this:

    java -cp ~/vnu.jar 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...

Other options are documented below.

HTTP client options

When using vnu.jar 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...

Most of the properties listed below map to the validator.nu common input parameters documented at github.com/validator/validator/wiki/Service:-Common-parameters.

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; to suppress
warning-level messages, and only show error-level ones, set this 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 Unicode smart
quotation marks in messages.

default: "yes"

possible values: "yes" or "no"

HTTP servlet options

nu.validator.servlet.connection-timeout

Specifies the connection timeout.

default: 5000

possible values: number of milliseconds

example: -Dnu.validator.servlet.connection-timeout=5000

nu.validator.servlet.socket-timeout

Specifies the socket timeout.

default: 5000

possible values: number of milliseconds

example: -Dnu.validator.servlet.socket-timeout=5000

Pulling from Docker Hub

You can pull the checker from the https://hub.docker.com/r/validator/validator/ repo at Docker Hub.

To pull and run the latest version of the checker:

  docker run -it --rm -p 8888:8888 validator/validator:latest

To pull and run a specific Docker-Hub tag/version of the checker — for example, the 17.11.1 version:

  docker run -it --rm -p 8888:8888 validator/validator:17.11.1

To run the checker with a connection timeout and socket timeout different than the default 5 seconds, use the CONNECTION_TIMEOUT_SECONDS and SOCKET_TIMEOUT_SECONDS environment variables:

  docker run -it --rm \
     -e CONNECTION_TIMEOUT_SECONDS=15 \
     -e SOCKET_TIMEOUT_SECONDS=15 \
     -p 8888:8888 \
     validator/validator

To define a service named vnu for use with docker compose, create a Compose file named docker-compose.yml (for example), with contents such as the following:

  version: '2' services:
    vnu:
      image: validator/validator ports:
        - "8888:8888"
      network_mode: "host" #so "localhost" refers to the host machine.

Build instructions

Follow the steps below to build, test, and run the checker such that you can open http://localhost:8888/ in a Web browser to use the checker Web UI.

  1. Make sure you have git, python, and JDK 8 installed.

  2. Set the JAVA_HOME environment variable:

    export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64 <-- Ubuntu, etc.

    export JAVA_HOME=$(/usr/libexec/java_home) <-- MacOS

  3. Create a working directory:

    git clone https://github.com/validator/validator.git

  4. Change into your working directory:

    cd validator

  5. Start the build script:

    python ./build/build.py all

The first time you run the build script, you’ll need to be online and the build will need time to download several megabytes of dependencies.

The steps above will build, test, and run the checker such that you can open http://localhost:8888/ in a Web browser to use the checker Web UI.

Use python ./build/build.py --help to see command-line options for controlling the behavior of the script, as well as build-target names you can call separately; e.g.:

  • python ./build/build.py build (to build only)

  • python ./build/build.py build test (to build and test)

  • python ./build/build.py run (to run only)

  • python ./build/build.py jar (to compile vnu.jar)