We can use httpie to make requests to the W3C validator.
For example, to test the file index.html
, run
https "https://validator.w3.org/nu/?out=gnu" @index.html "Content-Type: text/html; charset=utf-8" --print 'b'
and any errors or warnings will be printed to STDOUT.
You can also get the error format in JSON by using the out=json
syntax.
Another option which can be done locally is to use the python html5validator.
For example, if all your files are in a directory called html
, calling
html5validator --root html/ --also-check-css --show-warnings
will check all .html
files as well ass .css
files in that directory, and print warnings as well as errors.