How to use W3C tidy-html5 package on Mac OS via TextMate OR command line?

I have installed the W3C tidy-html5 package here: ~ / Library / Application Support / Avian / Pristine Copy / Bundles / tidy-html5

However, when I run the command in the terminal, it doesn't seem to recognize HTML5 tags. It seems like it is probably running the old HTML Tidy method, which only understands XHTML / HTML4.

For example, if I run:

tidy ~/Desktop/tidy-test.html

      

I am getting this output:

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

      

Ideally, I would like to be able to just draw the entire HTML5 document or selection directly in TextMate, just like now for XHTML. If this is not possible, I would like to run Tidy on the command line and return 1. a properly reformatted / ordered document and 2. a report of what was done with it.

+3


source to share


1 answer


Assuming you know and use Homebrew on your machine (OS X)
and install tidy

with Homebrew:

$ 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

      



Notes:

  • Skip the first step if you haven't installed tidy

    with Homebrew before .
  • Skip the second step if you are already signed in homebrew/dupes

    .
+3


source







All Articles