我在这里安装了W3C tidy-html5软件包: 〜/ Library / Application Support / Avian / Pristine Copy / Bundles / tidy-html5
但是,当我在终端中运行命令时,它似乎无法识别HTML5标签。它似乎可能运行旧的HTML Tidy方法,它只能理解XHTML / HTML4。
例如,如果我跑:
tidy ~/Desktop/tidy-test.html
我得到了这个输出:
line 1 column 180 - Error: <aside> is not recognized!
line 1 column 180 - Warning: discarding unexpected <aside>
line 1 column 353 - Error: <section> is not recognized!
line 1 column 353 - Warning: discarding unexpected <section>
line 1 column 418 - Warning: replacing invalid character code 139
line 1 column 419 - Warning: replacing invalid character code 134
line 1 column 421 - Warning: replacing invalid character code 139
line 1 column 422 - Warning: replacing invalid character code 134
line 1 column 424 - Warning: replacing invalid character code 139
line 1 column 425 - Warning: replacing invalid character code 134
line 1 column 427 - Warning: replacing invalid character code 139
line 1 column 428 - Warning: replacing invalid character code 134
line 1 column 430 - Warning: replacing invalid character code 139
line 1 column 431 - Warning: replacing invalid character code 134
line 1 column 432 - Warning: discarding unexpected </section>
line 1 column 443 - Error: <section> is not recognized!
line 1 column 443 - Warning: discarding unexpected <section>
line 1 column 567 - Warning: discarding unexpected </section>
line 1 column 578 - Error: <section> is not recognized!
line 1 column 578 - Warning: discarding unexpected <section>
line 1 column 645 - Warning: discarding unexpected </section>
line 1 column 656 - Warning: discarding unexpected </aside>
line 12 column 4 - Error: <canvas> is not recognized!
line 12 column 4 - Warning: discarding unexpected <canvas>
line 13 column 27 - Warning: discarding unexpected </canvas>
line 13 column 45 - Warning: discarding unexpected </html>
line 1 column 770 - Warning: trimming empty <span>
Info: Document content looks like HTML 4.01 Transitional
Info: No system identifier in emitted doctype
22 warnings, 5 errors were found!
This document has errors that must be fixed before
using HTML Tidy to generate a tidied up version.
Character codes 128 to 159 (U+0080 to U+009F) are not allowed in HTML;
even if they were, they would likely be unprintable control characters.
Tidy assumed you wanted to refer to a character with the same byte value in the
specified encoding and replaced that reference with the Unicode equivalent.
To learn more about HTML Tidy see http://tidy.sourceforge.net
Please send bug reports to html-tidy@w3.org
HTML and CSS specifications are available from http://www.w3.org/
Lobby your company to join W3C, see http://www.w3.org/Consortium
理想情况下,我希望能够直接在TextMate中整理整个HTML5文档或选择,就像我现在可以用于XHTML一样。如果那是不可能的,我希望能够在命令行上运行Tidy并返回1.正确重新格式化/整理的文档,以及2.对其执行的操作的报告。< / p>
答案 0 :(得分:3)
假设您知道并在您的机器上使用Homebrew(OS X)
并使用Homebrew安装tidy
:
$ brew uninstall tidy
$ brew tap homebrew/dupes
$ brew install --HEAD tidy
$ tidy --version
HTML Tidy for HTML5 (experimental) for Mac OS X https://github.com/w3c/tidy- html5/tree/c63cc39
备注:
tidy
,请跳过第一步。 homebrew/dupes
,请跳过第二步。