sublime text 2 - way to unminify or beautify HTML

totallyNotLizards picture totallyNotLizards · Nov 19, 2012 · Viewed 30.6k times · Source

I'm finding myself pasting in a tonne of code that is minified, i,e all on one line.

Rather than scanning through it manually and adding in linebreaks to make it readable, is there an option in Sublime to do it, or a plugin?

For example, I have this (although much longer):

<html><head><title>some title</title></head><body><div><span>some content</span></div></body></html>

And I want to end up with this, without spending half an hour pressing enter on my keyboard:

<html>
  <head>
    <title>some title</title>
  </head>
  <body>
    <div>
      <span>some content</span>
    </div>
  </body>
</html>

Answer

garyh picture garyh · Nov 19, 2012

If you have the Package Manager installed in you can install the Tidy HTML package.