Isn't it annoying how people can't seem to properly write, indent and get all the curly braces in their right places in their javascript code on the web? (Murmurs of agreement from the shady crowd.) Indeed, it is! That they don't share my preferences, which are of course much preferrable to those of anybody else. Yes. Thank you.


So I made this page, and a bookmarklet who together reindent the page you are visiting, or just the marked code parts of it, if you so prefer. A word of caution, though -- it uses GNU indent, which is a C language source formatting program, not really ideal for reindenting javascript code at all, but it mostly gets things right (syntax is not very different) -- and to date I have only seen it trash RegExp literals. (Transforming /opera/ to /opera /, for instance.) Feel free to drop me a note of other things it breaks if you like, or pointers to some more appropriate tool.