4

Is there a tool/web app that will automatically sort out an HTML file in to proper tab structure? For example, from this:

<table><tr><td>Hello Wolrd</td></tr></table>

to this:

<table>
    <tr>
        <td>Hellow World!</td>
    </tr>
</table>

I work with a lot of other peoples code, and I can't stand bad organization in HTML.

4 Answers 4

4

I use http://jsbeautifier.org/ and it works really good with HTML and JavaScript, besides you can configure identation, braces and other things

In this case, the output for your code is:

<table>
    <tr>
        <td>Hello Wolrd</td>
    </tr>
</table>

There's also http://dirtymarkup.com/ which seems useful as well.

I found http://www.freeformatter.com/html-formatter.html which has various formatters and validators.

Also there's http://infohound.net/tidy/ which seems to generate all the valid HTML markup in case you need it.

Another one is http://www.cleanuphtml.com/cleanup.html and there's the general purpose http://prettydiff.com/

Sign up to request clarification or add additional context in comments.

1 Comment

Pretty good, but after a bit of testing there's some small issues I'm seeing (like putting /> on a new line). I'll accept this answer if a better tool doesn't come along, it's almost perfect I'm just picky lol.
0

If you work with HTML a lot, then you need some kind of editor/development environment to help you.

There are many and they will most likely provide productivity features beyond just formatting.

So my advice would be to shop around and see which editor/environment suits your needs best, and use whatever formatting that particular tool provides.

1 Comment

I have a good editor, but I work with code that cowowkers or sometimes external sources create. I just needed a quick way to reformat all the code so it was actually readable. Thanks, though.
0

Commercially, Adobe's Dreamweaver has a very, very good "Apply Source Formatting" feature. That's probably not the price point you're talking about, but if you have a license already it works well.

Comments

0

You can use web apps for formatting HTML text. The web app which I use regularly is present at- HTML text freeformatter. Just follow 2-3 steps and you will get properly formatted HTML text.

If you are using microsoft visual studio 2012 or higher you can use following command to format HTML text-

Ctrl+k, Ctrl+f

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.