?
I don't know about Python, but for HTML you can roll your own formatter using pytidylib and HTML Tidy. It took me a few days of trial and error to make my own XML formatter but it works great and I learned a lot about Sublime and Python in the process. Not sure if HTML Tidy does CSS or JS, though.
Just looking into Sublime Text 2. So there is no way to format code other than manually? How did you get HTML tidy to work with ST2?
I followed the directions here:countergram.com/open-source/pyti ... index.html
But instead of "installing" pytidylib, I downloaded the source and put the "tidylib" directory under Sublime's Packages/User directory.
Then I had to change line 33 in init.py like so - putting 'tidy' first got it running on Windows.
LIB_NAMES = 'tidy', 'libtidy', 'libtidy.so', 'libtidy-0.99.so.0', 'cygtidy-0-99-0',
'tidylib', 'libtidy.dylib']
Then I created a Sublime command:
import sublime, sublime_plugin
from tidylib import tidy_document
class XmlTidyCommand(sublime_plugin.TextCommand):
def run(self, edit):
allRegion = sublime.Region(0, self.view.size())
allText = self.view.substr(allRegion)
document, errors = tidy_document(allText, options={'input-xml':1, 'indent':1, 'newline':'LF'})
self.view.replace(edit, allRegion, document)
if errors != "":
sublime.error_message(errors)
else:
sublime.status_message("Xml Tidy: No errors")