html-validator-cli is a command-line interface tool for validating HTML documents against the W3C's validator.w3.org/nu service. It offers a straightforward way to check HTML files, URLs, or raw HTML strings directly from the terminal. The current stable version is 7.0.1. The project demonstrates a moderate release cadence, with several patch and minor updates, and significant major version bumps (6.0.0, 7.0.0) tied to underlying `html-validator` library updates and Node.js engine requirement changes. Key differentiators include support for various output formats (JSON, HTML, text), the ability to ignore specific error messages, and options to validate local files or use a custom validator endpoint. It simplifies HTML validation workflows for developers by integrating directly into shell scripts and CI/CD pipelines without needing a browser or GUI.
npm install html-validator-cliNo compatibility data collected yet for this library.
Demonstrates how to install html-validator-cli as a dev dependency and use it via npm scripts to validate a URL, a local file, or an HTML string.
Upgrade your Node.js environment to version 10.22.0 or newer. If you must use an older Node.js, install an older version of html-validator-cli (e.g., `npm install html-validator-cli@6` for Node.js >= 8.15.3, or `npm install html-validator-cli@5` for older environments).
Carefully review the release notes for both `html-validator-cli` and `html-validator` when upgrading major versions. Test your validation workflows thoroughly to ensure expected output and behavior.
Always use `html-validator <local-url> --islocal` when validating HTML served from a local development server.
To get detailed validation results, use `html-validator ... --verbose` or specify an output format like `html-validator ... --format=json`.
Ensure the URL is publicly accessible or, if validating a local development server, use the `--islocal` flag (e.g., `html-validator http://localhost:8000 --islocal`). Check the URL for typos.
Install the package globally using `npm i -g html-validator-cli` or run it using `npx html-validator ...` to execute it without global installation.
Upgrade your Node.js version to 10.22.0 or newer. Alternatively, install an older compatible version of `html-validator-cli` (e.g., `npm install -g html-validator-cli@6` for Node.js >= 8.15.3).