简体   繁体   中英

Tool to Format HTML Code

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.

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/

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.

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM