从命令行验证HTML

时间:2021-08-22 00:11:36

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?

我是一名Web开发人员,他越来越多地使用Vim来编写网站代码。是否有任何HTML验证实用程序(或技术)将采取我正在处理的任何文件并验证其DOCTYPE而不离开shell?

4 个解决方案

#1


10  

You can use tidy together with a small Vim script.

您可以与小Vim脚本一起使用整洁。

#2


9  

Get yourself tidy from sourceforge and execute it on the shell
tidy -errors -q -f error_file.txt the_file.html

从sourceforge获得整洁并在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.

编辑2016年7月:源伪造版本已过时(请参阅@ phihag的评论)。它的后继者可以在http://www.html-tidy.org/和https://github.com/htacg/tidy-html5找到。

The History page on ttp://www.html-tidy.org/ states:

ttp://www.html-tidy.org/上的历史页面说明:

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.

2015年,一群关注的开发人员,用户和软件集成商组建了HTACG,目标是振兴已经陷入非维护状态的Tidy。作为W3C社区团体,HT3G被W3C认为是值得的,W3C将其项目的所有权转让给HTACG,目前正在开发并准备一个新的,稳定的和现代的版本。

#3


1  

Try an XML validator with the appropriate Schema/DTD.

尝试使用适当的Schema / DTD的XML验证器。

Here's a validator: http://xmlstar.sourceforge.net/

这是一个验证器:http://xmlstar.sourceforge.net/

Various DTDs available here: http://www.w3.org/TR/xhtml1/dtds.html

各种DTD可在此处获取:http://www.w3.org/TR/xhtml1/dtds.html

#4


0  

https://*.com/a/45390674/1587329 pointed to the nodejs-package html-validator-cli. Use as

https://*.com/a/45390674/1587329指向nodejs-package html-validator-cli。用于

html-validator --verbose --file=path/to-file

The --verbose flag is optional.

--verbose标志是可选的。

This connects to w3c's server, but does so on the command-line.

这连接到w3c的服务器,但在命令行上这样做。

#1


10  

You can use tidy together with a small Vim script.

您可以与小Vim脚本一起使用整洁。

#2


9  

Get yourself tidy from sourceforge and execute it on the shell
tidy -errors -q -f error_file.txt the_file.html

从sourceforge获得整洁并在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.

编辑2016年7月:源伪造版本已过时(请参阅@ phihag的评论)。它的后继者可以在http://www.html-tidy.org/和https://github.com/htacg/tidy-html5找到。

The History page on ttp://www.html-tidy.org/ states:

ttp://www.html-tidy.org/上的历史页面说明:

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.

2015年,一群关注的开发人员,用户和软件集成商组建了HTACG,目标是振兴已经陷入非维护状态的Tidy。作为W3C社区团体,HT3G被W3C认为是值得的,W3C将其项目的所有权转让给HTACG,目前正在开发并准备一个新的,稳定的和现代的版本。

#3


1  

Try an XML validator with the appropriate Schema/DTD.

尝试使用适当的Schema / DTD的XML验证器。

Here's a validator: http://xmlstar.sourceforge.net/

这是一个验证器:http://xmlstar.sourceforge.net/

Various DTDs available here: http://www.w3.org/TR/xhtml1/dtds.html

各种DTD可在此处获取:http://www.w3.org/TR/xhtml1/dtds.html

#4


0  

https://*.com/a/45390674/1587329 pointed to the nodejs-package html-validator-cli. Use as

https://*.com/a/45390674/1587329指向nodejs-package html-validator-cli。用于

html-validator --verbose --file=path/to-file

The --verbose flag is optional.

--verbose标志是可选的。

This connects to w3c's server, but does so on the command-line.

这连接到w3c的服务器,但在命令行上这样做。