Do you Tidy your code?

He has: 629 posts

Joined: May 2007

One tool I use on a regular basis is HTML Tidy, whether working on my own code or someone else's. It is available on all platforms, both as a command line tool or a GUI, and is built into many HTML editors. There are even online versions.

It fixes up many coding errors, can convert from ASCII to UTF-8 and back, fixes incorrect URLs, and loads of other helpful things. Yet most coders I speak to have never heard of it.

Do you Tidy your code?

Cordially, David
--
delete from internet where user_agent="MSIE" and version < 8;

They have: 17 posts

Joined: Jun 2008

If I'm not mistaken the W3 validators are (partially) based on Tidy, so I guess most of us uses it even if we don't know. The only difference is that in the validators' case it throws a warning, doesn't try to fix anything.

Megan's picture

She has: 11,421 posts

Joined: Jun 1999

I've heard of it but never really felt the need to use it, basically because I feel my code is good enough as it is. I guess I should give it a try and see what kind of changes it makes...

He has: 698 posts

Joined: Jul 2005

The editor I use actually has HTML Tidy built in, so every now and then I'll run it just to see what happens, but for the most part I have decent code, so it's not necessary.

It's a helpful tool to have built in to my editor though for more complex pages, just to be sure I have all my closing tags and everything. Smiling

Kurtis

decibel.places's picture

He has: 1,494 posts

Joined: Jun 2008

About 7 years ago I had an editor with Tidy that would mangle any file I gave it.

Guess the current version is better.

But I just try to write good code, sometimes I check in the FFox cconsole for errors.

He has: 629 posts

Joined: May 2007

methode wrote:
If I'm not mistaken the W3 validators are (partially) based on Tidy

The validators check against the DTD you give in your DOCTYPE - Tidy will suggest a DOCTYPE if you don't have one. Two very different tools for different purposes.
decibel.places wrote:
About 7 years ago I had an editor with Tidy that would mangle any file I gave it.

Perhaps the settings were wrong. Tidy has a whole slew of options, such as getting rid of Word's HTML cruft, converting to XML, formatting the output any which way, and so on.

I imagine it's the sheer range of options that puts people off using it, as it take a while to get all the options to suit your needs.

Cordially, David
--
delete from internet where user_agent="MSIE" and version < 8;

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.