• 
      

    Make long-form text entries use markdown formatting.

    Review Request #4506 — Created Aug. 28, 2013 and submitted — Latest diff uploaded

    Information

    Review Board
    master

    Reviewers

    Make long-form text entries use markdown formatting.
    
    There are several places in Review Board where users can enter long-form text:
    the review request description and testing done fields, comments, review body
    top and bottom, and change descriptions. Until now, all of these have just been
    preformatted text. This change integrates client-side markdown rendering for
    these fields.
    
    Because old text wasn't written with any feedback for what it would look like
    as markdown, this functionality is gated for only new entries in the database.
    A new boolean field called "rich_text" has been added to everything that could
    potentially be rendered. The evolutions ensure that all the old models have
    this set to false, and new ones will have it set to true.
    
    The way this works on the client side is that fields in the HTML are annotated
    with a data-rich-text attribute, which will be either true or false based on
    the rich_text field in the model. The various views which use these have been
    changed to call RB.formatText(), which will handle the hard work of formatting
    the text using marked.js if appropriate, as well as handle the special stuff we
    need to have it work with the inline editor.
    
    The style throughout is done to keep things visually pretty close to plain
    text, but with the nice benefits of emphasis, code samples, tables, lists, etc.
    One extreme example of this is that the font size is consistent throughout,
    even including headings.
    
    One thing which is left to do for this is to render the markdown text for use
    in HTML emails. I'm going to do that as a separate change because it's likely
    to be pretty big itself, and I'll need to do some research on rendering
    github-flavored markdown in python.
    
    This change is based loosely on Greg Wang's change from
    https://reviews.reviewboard.org/r/3892/
    
    - Checked that old review requests/comments were not rendered with markdown.
    - Tested using markdown syntax in each of the different rich text boxes.
    - Tested that rendering occured for each box after page load, and that things
      re-rendered after the values were changed.
    - Verified that bugs and review requests were properly linkified.
    - Tried inserting HTML (especially <script> tags) and saw that it was escaped
      properly.