I'm a web developer who is increasingly using Vim to code web sites. Are there any HTML validation utilities (or techniques) out there that will take whatever file I'm working on and validate against its DOCTYPE without leaving the shell?
In order to validate your code, you have to declare the standard to which it adheres. To describe the HTML standard (the document type declaration, DTD), the file should contain a DOCTYPE declaration (before the HTML code). Here are a few examples (from http://www.htmlhelp.com/tools/validator/doctype.html).
You can validate both HTML and CSS files. You can use any commercial software package or free online application, such as the following World Wide Web Consortium (W3C) validators: W3C CSS Validator at http://jigsaw.w3.org/css-validator/ W3C HTML Validator at http://validator.w3.org/
An HTML validator is a quality assurance program used to check Hypertext Markup Language ( HTML ) markup elements for syntax errors. A validator can be a useful tool for an HTML user who receives data electronically from a variety of input sources.
Get yourself tidy from sourceforge and execute it on the shelltidy -errors -q -f error_file.txt the_file.html
Edit July 2016: The source forge version is outdated (see @phihag's comment). Its successor can be found at http://www.html-tidy.org/ and https://github.com/htacg/tidy-html5.
The History page on ttp://www.html-tidy.org/ states:
In 2015 a group of concerned developers, users, and software integrators formed HTACG with the goal of revitalizing Tidy, which had fallen into a non-maintained state. As a W3C Community Group, HTACG was deemed worthy by the W3C, and W3C passed ownership of their project to HTACG, where it is currently being developed and prepped for a new, stable, and modern release.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With