- Introduction
- What Tidy Can and Cannot Do
- Downloading, Installing, and Running Tidy
- Working with the Tidy Options
- Software That Integrates Tidy
- Conclusion
Downloading, Installing, and Running Tidy
Tidy is free software, available from http://tidy.sourceforge.net. You can get a ready-to-run version of the program for a number of operating systems. Simply download the archive that contains the version of Tidy for your operating system and unzip the software to a folder in your path. For example, if you use Linux, extract the file tidy from the archive to the directory /usr/local/bin/. Windows users should unzip the file tidy.exe to the folder c:\windows or c:\winnt (depending on the version of Windows you're running).
Now that you have Tidy installed, you're ready to start cleaning up a few web pages. To get started, open a command prompt and change to a directory containing the HTML files that you want to clean up. Then type the following command:
tidy filename.html
For example, type this:
tidy index.html
The contents of the HTML file are displayed onscreen, along with information about the problems (if any) that Tidy detects in the file. In geek speak, what the program did was write results of the tidying run to the terminal.
Why did the Tidy write the results to the terminal instead of cleaning up your file? Because you didn't indicate what you wanted Tidy to do. Like most software, Tidy is very literal-minded: You must explicitly state what you want it to do. The simplest way to do this is to have Tidy copy its output to a new file. You do this by redirecting the output to another file, like this:
tidy filename.html > filename2.html
Instead of writing the results to the terminal, Tidy copies the results to the file that you specify.