Improve formatting for Markdown.

We try to keep our Markdown rendered output as close as possible to the
source text formatting, but there's only so much that can be done by
CSS. This change massively improves the rendering by introducing a set
of new Markdown processors that clean up newlines and attributes, giving
us the output our users would expect.

This primarily does the following:

* Keeps the correct number of blank lines between blocks (by default,
  Python Markdown will just trim them away).

* Keeps code blocks (and certain other extension-provided blocks) from
  having an unnecessary extra blank line after the HTML (interfering
  with our <pre> formatting).

* Allows line breaks in lists.

* Wrapped lines of text inside an ordered list item no longer shows the
  wrapped text at the same indentation level as the item's counter
  value. It now properly stays within the confines of the list item.

  To make this happen, we had to use CSS counters and some custom
  styles (using `display: table` and friends).

* Allows ordered lists to start at a particular value. We do this by
  turning off lazy_ol, which gives us a start= attribute on the list.
  Then, to get it to play nice with the custom counters mentioned above,
  we have a Markdown block processor that adds CSS to the <ol> that
  initializes the counter to the right value.

* Adds unit tests to ensure these formatting rules do not break in
  the future.

The result is much nicer formatting for most cases (all cases I've
tested).

Reviewed at https://reviews.reviewboard.org/r/6643/
Improve escaping text for display in Markdown.

Our former approach of escaping text for use in Markdown was to define a
large regex containing patterns, and any pattern that matches was
fully escaped. This was fine for simple patterns, but it wasn't possible
to escape only a single character or set of characters in more complex
patterns.

Each pattern in the regex can now capture zero or more groups, each of
which will be individually escaped. To do this, we loop through the
groups, escaping each match and inserting that into the resulting
string. It means we do loop on each match through each possible capture
group (including those from other patterns), but it also means we no
longer have to go back through the whole string looking for and escaping
characters, just subsets. (We're really talking a ~50 microsecond
difference for a commit message with a handful of Markdown-unsafe
content anyway).

With this change, we were able to make two escaping fixes:

1. Lines starting with things like "1.2.", which are not list items,
   are no longer escaped.

2. '>' characters are no longer escaped unless they're an autolink
   (like <foo@example.com> or <http://example.com>) or a blockquote
   (single level or nested).

Reviewed at https://reviews.reviewboard.org/r/6653/
Fixes tabs appearing in the subject line of emails.

Python 2.7 has a problem that causes tabs to be used to break up long headers
instead of spaces. When Review Board sends an email with a Subject longer than
62 characters, it inserts a tab to seperate the text into mutiple lines.

Now instead of the Subject header being seperatated by tabs it is seperated by
spaces.

Testing Done:
Ran unit tests.

Bugs closed: 3613

Reviewed at https://reviews.reviewboard.org/r/6647/