im wondering if there is any Sublime Text 3 plugin besides HTML Tidy which is able to reindent or reformat parts of HTML Code
Asked
Active
Viewed 3.3k times
8
-
Potential solutions discussing sublime text 2, but i doubt that the functionality has changed very much: http://stackoverflow.com/questions/8839753/how-do-i-reformat-html-code-using-sublime-text-2 – lizz Feb 11 '14 at 21:12
2 Answers
36
Thanks a lot for your answer, but i found a nice, built in approach of sublime text. Just select everything (CTRL + a (Windows) or CMD + a (Mac) and click this in the menu
Edit → Line → Reindent
maybe this helps also others
EDIT(2017): You can also use key combination (without need for mouse)
CTRL + SHIFT + P (Windows)
CMD + SHIFT + P (Mac)
then type 'Reindent' and select the fist option 'Indentation: Reindent Lines'

Mik
- 1,705
- 1
- 14
- 26
-
1Note that this only re-indents code and doesn't take care of any other re-formatting issues – gilad905 Feb 16 '17 at 11:12
-
This didn't work for me for sublime 3 php files. It does work for html, css and js though. – user31782 Oct 14 '21 at 11:20
7
Check out HTML-CSS-JS Prettify
. It requires nodejs be installed and in your PATH
, but once you get that set up properly it works great. Make sure you read all of the docs, though.

MattDMo
- 100,794
- 21
- 241
- 231