Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

25 lines (20 sloc) 0.707 kb
import commands, re
import sublime, sublime_plugin
class HtmlprettifyCommand(sublime_plugin.TextCommand):
def run(self, edit):
self.save()
self.prettify(edit)
def save(self):
self.view.run_command("save")
def prettify(self, edit):
regx = re.compile(" ")
html = commands.getoutput("node " +
regx.sub("\ ", sublime.packages_path()) + "/HTMLPrettify/scripts/run.js " +
regx.sub("\ ", self.view.file_name()) +
" indent_size:\ 2" +
" indent_char:\ ' '" +
" max_char:\ 80" +
" brace_style:\ collapse")
if len(html) > 0:
self.view.replace(edit, sublime.Region(0, self.view.size()), html)
sublime.set_timeout(self.save, 100)
Jump to Line
Something went wrong with that request. Please try again.