Sublime Forum

How to Tidy HTML

#1

Is this possible in Sublime? Is there a package that will tidy html (and erb if possible) (no scripts please)? It is dead simple in Textmate and it is critical to productivity when doing tag wraps around selections.

0 Likes

#2

You can setup a command to run to replace a selection of html with the tidy version. Press Ctl+R to bring up the command window and enter tidy -utf8 -asxhtml -i for the command which formats indented xhtml using utf8 encoding. Check the two boxes to “Pass selection as input” and “Insert output”. You can also specify custom key bindings there.

0 Likes

#3

What does CTRL-R bring up on Windows? On my Mac, CTRL-R does nothing, and Cmd-R brings up the “find anywhere” box, which I assume is not what you’re talking about…

0 Likes

#4

Jim1 is referring to the Python Console (which is opened with ctrl+`) However, there is a much easier way to tidy HTML. Check out the Tag plugin https://github.com/SublimeText/Tag.

0 Likes

#5

I have the Tag plugin and there is NO tidy function. So I take it this is beyond ST2 at this time. This is really surprising given the other capabilities. I need to have the ability to wrap a section in a new tag and then have it indented properly. The current command for wrapping a tag around a selection mangles the indentation so much as to be useless. It is more time effective to do it by hand. I have to assume that it was intended as a step in wrapping as the ST2 method of wrapping multiple lines with multiple tags is very nice. But even in that case it still needs to be tidied. If only after that I could then run a simple tidy to get the nesting and indention right it would be great.

0 Likes

#6

Once you have the Tag plugin installed, the applicable command is “Indent Tags on Document”. Took me forever to figure that out, but it works great.

dc

0 Likes

#7

[quote=“dhc02”]
Once you have the Tag plugin installed, the applicable command is “Indent Tags on Document”. Took me forever to figure that out, but it works great.

dc[/quote]

And why not name the fucntion o that it will be clear what it if for! Thanks, dhc02

0 Likes

#8

HTML tidy is the probably the most popular HTML tidying utility available.This is an online version of HTML Tidy.It can be used on all major operating systems.In this is the best time to consider using HTML Tidy.Please try it, it works great

[size=85]website design chennai[/size]

0 Likes