Proper indentation of code generated inside hooks

I don’t think correct global indentation is possible without massive (and inefficient) output buffering to change it.

Since you are primarily interested in this for debug purposes I suggest using some tool that will format and color-code output (of any page btw, not just those that you control).

Firebug and View Source Chart work nicely for me.