If you write HTML code by hand, you may already be familiar with
tidy, a program that checks your code, tells you where there are errors, and, in some cases, corrects them.
is an open-source program that is available for many platforms, and is also included in certain text editors, such as
Tiger, Mac OS X includes a command-line version, located at
/usr/bin/tidy. You can generate cleaned-up versions of HTML, XML, and XHTML files, and you can even convert files among these different formats. For example, you can Convert HTML to well-formed XML and output to a new file (hit control-D after the output is finished):
tidy -asxml test.html -output fixed.xml
If you just want to display errors and quit:
tidy -errors test.html
Or if you want to change all your tags to upper case:
tidy -upper test.html
For more on using the command-line version of tidy, type
man tidyin Terminal.
If you don’t want to use the command line, and don’t work with one of the text editors mentioned above, you can install Tidy Service, which adds this functionality to your Services menu for use with Cocoa applications.
However you use it, Tidy will help you not only write correct HTML code, but also clean up any unnecessary tags. It can save you time and make your Web pages better and more efficient.