I'm looking for a tool or editor where I can paste in potentially messy code, be it HTML, Javascript, CSS, whatever, and properly take care of all indentation and spacing.
I use Geany but I don't see an option for this, surprisingly. I don't know if it's possible in vim or emacs. Any help would be appreciated.
Example HTML:
<!DOCTYPE html>
<html>
<body>
<ul>
<li>what a mess</li>
</ul>
</body>
</html>
Both vim and emacs will let you do what you ask. I believe in vim you want to use 'gg=G', and emacs is C-x C-M-\
I hope this helps.