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?
You can use tidy together with a small Vim script.
Get yourself tidy from sourceforge and execute it on the shell
tidy -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.
type=
for script tags and does not recognize <meta charset="utf-8"/>
–
Puttee You can use tidy together with a small Vim script.
<div>
tag, tidy won't mention that among its errors. –
Heng Try an XML validator with the appropriate Schema/DTD.
Here's a validator: http://xmlstar.sourceforge.net/
Various DTDs available here: http://www.w3.org/TR/xhtml1/dtds.html
https://mcmap.net/q/539671/-are-there-any-command-line-validation-tools-for-html-and-css-closed pointed to the nodejs-package html-validator-cli
. Use as
html-validator --verbose --file=path/to-file
The --verbose
flag is optional.
This connects to w3c's server, but does so on the command-line.
© 2022 - 2024 — McMap. All rights reserved.
<div>
tag, tidy won't mention that among its errors. – Heng