Support custom syntax highlighting in the diff viewer

Review Request #1180 — Created Oct. 25, 2009 and discarded


Review Board


Pygments supports lots of styles, but RB currently only supports its own simple syntax highlighting. This is a first step toward supporting custom syntax highlighting. Just looking for comments on the approach.

* Add a script to generate all available pygment highlighters as static CSS files
* Add an admin field to choose the desired style
* Update templates to use a selector for the syntax highlighting

This change works well enough with light-background styles, but not with dark-background styles. We'd need to support styling the changed line backgrounds based on the colorscheme of the theme for this to work well. Also needs a drop-down for selecting styles, css to be automatically generated on install, and user-selectable themes.
Unit tests pass. Tested diff fragments and review comment fragments with different pygments color schemes. Tested generating a new database.
  2. reviewboard/diffviewer/ (Diff revision 1)
    make sure this fits on 80 lines.
    might want to just do:
    formatter = HtmlFormatter(style=style)
    return pygments.....
  3. We'll need to factor in the current style in when caching the views. Otherwise, this might be stale.
    1. Yup, I figured that would be a problem particularly with if it's user configurable. Of course I have no idea how the caching stuff works, but I'm sure I'll figure it out.
  4. Same here.
Review request changed

Status: Discarded