HTML Tidy is an open source software package to create readable, well-formatted HTML code. Links to various versions, with different strengths and weaknesses and for various platforms, can be reached at the Sourceforge project page. To directly download the file click here (or here, if you're reading this sometime after April 2008 and want to check for more recent versions).
While Tidy's default behaviour is ok for basic PPing checks, there are many options you can set. Most of these relate to the formatting of the output file, should you allow Tidy to actually alter your code—which is discouraged by the PPVers and WWers because it is advantageous to keep the HTML wrapped like the text version, and because with default settings Tidy output is rather illegible. However, it can be helpful to Tidy a small portion of code, such as a table or nested lists, with suitable indentation options set. Also, you can have Tidy warn you about possible accessibility problems according to the Web Content Accessibility Guidelines.
To configure Tidy: Create a file containing the options you want. (You could call it tidy.conf and put it in your home directory, for example.) Those options you don't specify will remain at their default values. For example
accessibility-check: 2 doctype: strict enclose-block-text: yes enclose-text: yes indent: auto newline: LF tab-size: 4 wrap: 72
Tell Tidy where to find this file
- If you use Tidy from the command line just specify the configuration file using -config
- If you use it within Guiguts or elsewhere, set the environment variable HTML_TIDY to the path and filename of the configuration file you created.
For example, on a Mac or Unix system, add the lines
HTML_TIDY="~/tidy.conf" export HTML_TIDY
to your .profile and.or .bashrc file.