views:

2224

answers:

8

Simple question - I've got a bucketload of cruddy html pages to clean up and I'm looking for a open source or freeware script/utility to remove any junk and reformat them into nicely laid out consistent code. Any recommendations?

If it's relevant I generally manipulate HTML inside Dreamweaver - but by editing the code and using the wysiwyg window as preview rather than vica-versa - so a Dreamweaver compatible script would be a plus.

+16  A: 

I don't think it plugs into Dreamweaver but whenever i need html cleaned up HTML Tidy is my go to guy

Harald Scheirich
+3  A: 

I second HTML Tidy.
I just wanted to add it is a library with various ports and bindings. As such it is also integrated in some editors like HTML-Kit or NoteTab, and it has a GUI front end. All these are linked in the page given above.
Note also that the W3C Markup Validation Service has an option to "Clean up Markup with HTML Tidy" (after validation result display).

PhiLho
A: 

You can even buffer your existing HTML through HTML Tidy before it reaches the browser - if it's a low traffic site, then this will make things neat without any effort.

Rich Bradshaw
+1  A: 
81bronco
A: 

I use the HTML Formatter...it does exactly what you are looking for.

A: 

I too recommend HTML Tidy, whilst its not maintained by Dave Ragett anymore the tool is definitely being updated frequently with tweaks.

I use HTML Trim which is a win32 app to cleanup some awful autogenerated blobs of code that some of our devs knock up.

You can also grab the command line version which you may able to integrate into Dreamweaver.

Sorry i cant post more than one hyperlink - still a n00b here.

Thushan Fernando
A: 

I definitely think the best tool out there is the HTML Formatter from Logichammer.com. It does exactly what you need and is dead simple to use. Worth it to check out...the guy even has a video on his site showing how easy it is to use. I've been using it for two years now and couldn't live with out it...I get lots of messy code.

Bob Crish
A: 

I would recommend vim. You could format a block of code with v to select the block and '=' to indent the code.

Jichao