Google Site SearchFN Site Search FN Blog Login FN Blog Login
Site Navigation:
 
 

REVIEW: HTML Tidy

by Gavin Henry

Introduction:

"When editing HTML it's easy to make mistakes. Wouldn't it be nice if there was a simple way to fix these mistakes automatically and tidy up sloppy editing into nicely layed out markup? Well now there is! Dave Raggett's HTML TIDY is a free utility for doing just that. It also works great on the atrociously hard to read markup generated by specialized HTML editors and conversion tools, and can help you identify where you need to pay further attention on making your pages more accessible to people with disabilities".

I had been looking for a quick way to upgrade my html sites, and found Tidy.

Tidy reads HTML, XHTML and XML files and writes cleaned up markup.

A common use of Tidy is to convert plain HTML to XHTML.

It makes these files fully compliant against W3C standards and allows your site to be in the most up to date markup language.

You can check that your site is compliant at the W3C's Validator page. They also have an online Tidy version available on that page too.

Details:

In order to use Tidy you obviously need the rpms. In order to download them with apt-get, you need to modify one line in your

/etc/apt/sources.list

Halfway down Jorge Gallegos's apt page, you will see the line

rpm http://download.fedora.us/fedora fedora/1/i386 os updates stable

Just add the word

testing
to the end of the above line, run "apt-get update" as root, then "apt-get install tidy". That's all there is to it.

If for some reason this doesn't work, FC1 rpms are available from the main download site, but don't forget to grab the libtidy rpm too.

Commands:

To check a page without changing anything, use this command:

tidy -errors mypage.html

To convert a file in-place:

tidy -modify mypage.html

To convert a file from html to xhtml, placing the output in a new file:

tidy -o mynewpage.html -asxhtml mypage.html

To convert an existing file from html to xhtml without creating a new one:

tidy -modify -asxhtml mypage.html

For more tips type

tidy --help
and
man tidy

Conclusion:

Tidy is a brilliant program and can really speed up your websites conversion to a compliant site.

Well, that's it for now. For any comments or corrections, please e-mail me.