Program/editor to format existing HTML code

LCMSdev
LCMSdev used Ask the Experts™
on
I need to modify HTML code that was exported from another program. This code was never intended to be read by human eyes, so while it is technically error-free (tags properly ordered and closed, etc.), the formatting leaves much to desired. One line in particular is 16,548 characters long without a line break. You can see where this would be annoying to work with.

I'm looking for a program that will format this text to be more easily readable. It can either modify the file directly, or allow me to paste the contents into the program for formatting. Proper indenting would be wonderful, but even just adding line breaks between tags would be fantastic.

The simpler the solution, the better...I gather I could do something like this with emacs or the like, but I don't have time right now to learn a complex editor, so I wouldn't want to use one unless the command that does this is built-in and easy to run. Basically, I'm hoping someone has had the same problem as me and written an application specifically to solve it.

Any suggestions are greatly appreciated.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Author

Commented:
Forgot to mention...I also have Visual Studio 2008 installed, if that's of any use.
Top Expert 2005

Commented:
HTMLTidy? http://tidy.sourceforge.net/#source  At least I thought that was what this does.
Top Expert 2005
Commented:
I put this in HTML Tidy (actually the GUI Interface at http://www.paehl.de/tidy/optimize.zip)

<html><head><meta http-equiv="Content-Type" content="text/html; charset=windows-1252"><title>New Page 1</title></head><body></body></html>

And I got this out:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2//EN">

<html>
<head>
  <meta name="generator" content=
  "HTML Tidy for Windows (vers 18 June 2008), see www.w3.org">
  <meta http-equiv="Content-Type" content=
  "text/html; charset=us-ascii">

  <title>New Page 1</title>
</head>

<body>
</body>
</html>

NOTE: I didn't mess with the myriad options and selected the "Optimize As HTML" button, and Tidy added the <DOCTYPE...> and the <meta name="generator" content="HTML Tidy for Windows (vers 18 June 2008), see www.w3.org">

which were not in the original.  I'm sure if I took time to go through the options, those probably could be suppressed.

Author

Commented:
Perfect, thanks!
Top Expert 2005

Commented:
Thank you, and I'm happy I could help.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial