[![builds.sr.ht status](https://builds.sr.ht/~heckyel/w3c-validator/commits/.build.yml.svg)](https://builds.sr.ht/~heckyel/w3c-validator/commits/.build.yml?) # w3c-validator The `w3c-validator.py` script uses the `curl(1)` command to submit HTML files and URLs to the [W3C Markup Validation Service](https://validator.w3.org/) and CSS files and URLs to the [W3C CSS Validation Service](https://jigsaw.w3.org/css-validator/). The script parses and reports the JSON results returned by validators. ## Requirements - Python 3 - Curl - An Internet connection ## Usage The script command syntax is: python w3c-validator.py [--verbose] FILE|URL... - The optional `--verbose` option will print information about what is going on internally. - Names with a `.css` extension are treated as CSS, all other names are assumed to contain HTML. - Names starting with `https://` are assumed to be publically accessible URLs, all other names are assumed to be local file names. - Any mix of one or more local files or HTTP URLs can be specified. - If one or more files fail validation then the exit status will be 1, if no errors occurs the exits status will be zero. Examples: ```bash $ python w3c-validator.py tests/data/something-html5-file.html validating: tests/data/something-html5-file.html ... error: line 822: The tt element is obsolete. Use CSS instead. ``` ```bash $ python w3c-validator.py https://www.methods.co.nz/asciidoc/layout1.css validating: https://www.methods.co.nz/asciidoc/layout1.css ... ``` ## References - [User's guide for the W3C Markup Validator](https://validator.w3.org/docs/users.html) - [CSS Validator User's Manual](https://jigsaw.w3.org/css-validator/manual.html) ## License This work is licensed under the [GNU GPLv3+](LICENSE)