I am using django templating, and for readability I have html that looks similar to the following:
{% if some_variable %} text {% else %} nothing exi
If you're using with Nginx its Strip module is doing really great job with cleaning the html for you. It's real time and transparent. You don't need to care about at all after you set it up correctly.
http://wiki.nginx.org/HttpStripModule