Properly escape HTML based templates.

Properly HTML-escape everything in the HTML templates. Also remove leading spaces from `<pre>` elements.