Moving formatting logic around.  Code is hopefully a bit cleaner, but
more importantly it allows me to HTML-format specific sections instead
of having to format all or nothing.