Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

I have made the mistake of not indenting the HTML tags on a page that slowly grew to over 500 lines of dense HTML. I have looked for a tool to fix the indentation, but what I have found so far seem to insist on doing additional formatting, and I really don't need those 500 lines to become 1000 because big bunches of small tags get one line per tag.

Any suggestions for a tool to do the job?

share|improve this question

2 Answers 2

You didn't tell us which tools you tried so far, but the first that comes to my mind is HTML Tidy: http://tidy.sourceforge.net/

share|improve this answer
    
Sorry, yes I tried Tidy, though only with a webpage interface. I can't get it to not inject a bunch of lineshifts, it's quite bad with tables, two lines per td element is way too much. It also feature messing up the JavaScript and CSS tab indentation. –  eBusiness Jan 19 '11 at 21:52
1  
@ebus Tidy has a LOT of configuration options, I recommend you try it in htmlkit.com where it can be configured via a nice GUI –  Jeff Atwood Jan 19 '11 at 23:11

The JetBrains IDEs allow you to reformat your code based on a set of rules, so you can get as detailed or as simple as you want. If this is a one-time thing, you could always use the trial copy of whichever one is most appropriate for you to reformat your code.

WebStorm is probably your best bet, although if you're developing your web applications with PHP, Ruby on Rails, or a few other languages, they have you covered there, too.

share|improve this answer
    
Seems like it may be able to do the job, gotta experiment a bit more to get it just right though. Hadn't imagined this would be so complicated. Performance is pretty bad when working with a 100kB file by the way. –  eBusiness Jan 20 '11 at 0:01

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.