Monday, October 24, 2011

tidy/reformat/beautify/pretty-print html by

HTML syntax checker and reformatter

Corrects markup in a way compliant with the latest standards, and optimal for the popular browsers.
It has a comprehensive knowledge of the attributes defined in the HTML 4.0 recommendation from W3C, and understands the US ASCII, ISO Latin-1, UTF-8 and the ISO 2022 family of 7-bit encodings.

In the output:
 * HTML entity names for characters are used when appropriate.
 * Missing attribute quotes are added, and mismatched quotes found.
 * Tags lacking a terminating '>' are spotted.
 * Proprietary elements are recognized and reported as such.
 * The page is reformatted, from a choice of indentation styles.

sudo apt-get install tidy

// tidy version 25 March 2009

//markup: yes
//break-before-br: no
indent: yes
//indent-attributes: no
// add indent-spaces to avoid bug
indent-spaces: 2
vertical-space: yes
wrap: 0
wrap-php: yes
//char-encoding: utf8
input-encoding: utf8
output-encoding: utf8
tidy-mark: no
// output-xhtml to avoid error of save same buffer many times
output-xhtml: yes
// w/o quiet: yes option, error might show
quiet: yes
doctype: strict

Useful options
-indent, -i
= indent element content

= use UTF-8 for both input and output

-asxml, -asxhtml
= convert HTML to well formed XHTML (output-xhtml: yes)

-wrap , -w
= wrap text at the specified .
Set wrap to zero if you want to disable line wrapping.
0 is assumed if is missing.

--tidy-mark no
= if Tidy should add a meta element to the document head to indicate that the document has been tidied.
(Default: yes)

More info
man tidy


No comments:

Post a Comment