ghostCoder
ghostCoder

Reputation: 7655

indenting html code

I have an html file (size about 260kb) whose source code is not formatted. i.e., all the tags and all the code of the html file are on one single line. So, on opening it in gedit(or notepad) its impossible to understand its contents. Is is possible to somehow indent it according to tags so that all tags come on different lines and the html code becomes comprehendible. Please help.

Upvotes: 2

Views: 2325

Answers (6)

Roy
Roy

Reputation: 31

Try out purehtml.in. It takes care of indenting for HTML tags, including content within script and style tags.

Upvotes: 3

Rui Jiang
Rui Jiang

Reputation: 1672

If you're using Visual Studio, the command Ctrl+k+d does it.

Upvotes: 2

jhurtado
jhurtado

Reputation: 8747

Try Tidy!

Upvotes: 2

Michael Berry
Michael Berry

Reputation: 72284

Have you got an IDE to hand? I use Netbeans and generally if I want to format something like that, I'll paste its contents into a new HTML file within Netbeans, hit alt+shift+f to auto-format it, then paste it back to wherever it needs to go.

If not then there's an online tool here.

Upvotes: 2

Eric Mickelsen
Eric Mickelsen

Reputation: 10377

If it's XHTML, or close to it, you can use these: https://stackoverflow.com/questions/521265/any-online-xml-formatter-or-formatter-in-free-text-editor

Upvotes: 2

m.edmondson
m.edmondson

Reputation: 30882

You mean aside from tabbing yourself? Try HTML Tidy Online - it has an automatic indentation function.

Upvotes: 4

Related Questions