HTML Editor That Indents Code As Illustrated


After a page of code gets a certain length it really seems to me to be unintelligible because the indenting breaks down, or is inconsistent.

I've purchased lots of text editors; HTML valdating text editors; WSYWIG programs.  Many promise to indent the code logically out of the box.  

Others say there are settings which, if selected in combination, will indent HTML so that it's easier to read.

Here's a pretty good illustration of the code appearance I'm going for:

I'd be happy if I could even just get this much to work: "Best method: indent text/content ".

Is there any editor that you all know of that will do most of this formatting as you type?  Or, if it's not automatic, an editor whose settings you know can be selected with some simplicity to achieve this outcome.


Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

HTML Tidy is a popular tool.

Notepad++ has several HTML Tidy functions:
oaktreesAuthor Commented:

Yep.  I've seen that.  You're right.  What I'm thinking of is something that constrains, forces it to be tidy as it's being entered.  An as-you-go sort of tool, so that if I typed in:

<p>Here is some amazing text that redefines the concepts of thought and philosophy.  Touching on ideas of art, history and science, what's here is compelling and asks to be read and shared.</p>

Then, that code gets auto pushed-around into a beautiful indented layout, as illustrated in the link.  Something that applies the indenting as you go.


Dave BaldwinFixer of ProblemsCommented:
Since reformatting the text with tags on separate lines will add hidden white space, I would never use an editor that did that.  Too often I have to go eliminate white space because it interferes with programming or layouts.
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

@Dave, that intends entirely on the context of the code being developed. Since browsers remove white space from HTML, the OP's request is certainly legitimate.

@oaktrees, Notepad++ lets you assign shortcut keys to its macros and add-ins. That means you can assign whatever shortcut you want to the HTML Tidy add-in. So type your code, then press Ctrl-Shift-T or Crtl-Shift-H (or whatever shortcut you assign) and your code is instantly reformatted. That's not quite real-time, but it's pretty close.
Dave BaldwinFixer of ProblemsCommented:
Yes, but whitespace in the wrong place can cause PHP to fail.
oaktreesAuthor Commented:
Hello Dave & Thomas!

Feel grateful for the replies.  Many thanks!!

Seems what I'm driving at is a kind of as-you-type effect.  Here's my motivation: in some sense well-formatted code is a clue unto itself - a kind of topography where one can scan and see where the errors are, and how larger elements relate to each other.  More importantly: it should reveal where wrongly coded things are, and / or where those things sit.

Thomas, you're right - I could run the macro.  Seems that most of my issues arise long before I'd get to running the macro, though.  I'm making a mess of the code as I go along.  By the time I'm done I know less about how all the parts functions relative to the whole because, lacking the indentation, it's messy enough to make me feel confused: I'm not sure what I've got, even though, in many cases, it's working.  

The author of the link ( ) says that there is a way of getting most editors to handle indenting in nearly an as-you-enter fashion.  Has anyone ever done that with one of these he's mentioned, or any other editor?
Dave BaldwinFixer of ProblemsCommented:
My main editor is HTML-kit and it will auto-indent to the last indent you used when you press enter.  So does PSPad .  And Notepad++ .
oaktreesAuthor Commented:
Hello Dave!

Wow!  Awesome - great!  In HTML Kit - is there any setting, or array of setting I should select to get the outcome I'm shooting for?  Or, will it work that way pretty much out of the box?


Dave BaldwinFixer of ProblemsCommented:
I don't remember.  I've been using it for more than 10 years and I rarely change the settings for anything.
oaktreesAuthor Commented:
Are you using the Free one or the Pro / paid version?
Dave BaldwinFixer of ProblemsCommented:
I paid for it over 10 years ago.  Back then it didn't change the program version but gave you privileges to download some extra stuff.  I have both HTML-kit 292 and HTML-kit Tools which is the newer version.  I think I paid for that too.  Neither were very much money.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Development Software

From novice to tech pro — start learning today.