Markdown Review UI

Review Request #4414 — Created Aug. 10, 2013 and submitted — Latest diff uploaded

Information

Review Board
master

Reviewers

Markdown Review UI

This adds functionality to render Markdown file attachments in Review Board.

The rendering is handled by the "markdown" Python package which, given a file,
returns the HTML code for it. This HTML code is then passed to the Backbone
view for the Markdown Pluggable UI through the template and rendered in the
browser.

This is based on the change at https://reviews.reviewboard.org/r/3434/
The major changes are:
- Port to the new 1.8.x JS model/view parameters and remove the extra template
  file.
- Use safe_mode='escape' when rendering to disallow users from using arbitrary
  HTML tags.
- Add comment thumbnails, so we get excerpts in the reviews page. I can't
  decide if using minidom to parse the outputted HTML and extract a specific
  node is awesome or awful, but it seems to work very reliably and keeps us
  secure.
- Cache the rendering of the markdown file, which comes in handy for those
  comment thumbnails.
"Valid" Case:
1) Created a review request and uploaded multiple random files to it
2) Then, uploaded a valid Markdown file (with the extension .md) to that review
   request
3) Clicked the "Review" link for the Markdown file
4) The new page loaded should render the Markdown file

"Invalid" Case:
1) Created a review request and uploaded multiple random files to it
2) Then, uploaded an image to that review request by changed the file extension
   to be ".md". For example, wallpaper.png -> wallpaper.md
3) Clicked the "Review" link for the invalid Markdown file
4) The new page loaded did not render anything (i.e. it displayed the title and
   caption but nothing was displayed in the section where the HTML would have
   rendered)