Render markdown fields for HTML emails.

Review Request #4844 — Created Oct. 24, 2013 and submitted

Information

Review Board
master

Reviewers

Render markdown fields for HTML emails.

This change adds some slightly questionable code to render markdown to HTML for
the HTML emails. Annoyingly, python markdown doesn't interpret the input quite
the same as marked.js, so some things don't render the same (this is mostly
edge cases, particularly with the treatment of things like whether lists
require a blank line before them or not).

This includes a simple extension for python-markdown that will go through the
resulting element tree and add inline styles. These styles are similar to what
we get from reviews.less, but somewhat simplified.

Viewed the html email previews for review requests, reviews, and replies with
markdown in the review request fields, review body_top/bottom, and comments.
Saw all of the fields rendered to markdown, instead of seeing all the control
and escape characters.

Description From Last Updated

"implementing"

chipx86chipx86

Slightly more efficient as: el.set('style', ''.join([ '%s: %s;' % (k, v) for k, v in style.iteritems() ]))

chipx86chipx86
chipx86
  1. This is terrible, and I kind of love it for that.

  2. Show all issues

    "implementing"

  3. A lot of the bullet list styles are there to just keep the resulting list as close as possible to the source text, to prevent jumps when going back and forth between editing/viewing. Probably not so important for e-mails. I imagine you could just nuke all the ol/ul/li rules pretty safely. That said, I don't care either way.

    The "ch" unit is pretty new in terms of browser standards. Chrome 25+, IE9+, and Firefox 19+. New enough for the browsers we care about, but really wondering how many e-mail clients recognize that. That worked in your tests fine?

  4. Show all issues

    Slightly more efficient as:

    el.set('style', ''.join([
       '%s: %s;' % (k, v)
       for k, v in style.iteritems()
    ]))
    
  5. 
      
chipx86
  1. Might also be good to have a comment in the .less file for this saying to update this file when the rules change.

  2. 
      
david
chipx86
  1. Ship It!
  2. 
      
david
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to master (0bc5880).
Loading...