Ticket #4246 (closed enhancement: fixed)
Adopt Pygments for syntax highlighting
| Reported by: | cmlenz | Owned by: | cmlenz |
|---|---|---|---|
| Priority: | normal | Milestone: | 0.11 |
| Component: | general | Version: | 0.10.2 |
| Severity: | major | Keywords: | mimeview highlighting |
| Cc: |
Description
Pygments provides very nice—and pure Python—syntax highlighting. We should strongly consider adopting it as the default highlighter for future Trac releases, probably starting with 0.11, seeing how the current Enscript/Silvercity/PHP methods all suck.
Matt has already cooked up a Trac plugin for Pygments here.
I'm attaching some patches for both the Trac Mimeview component and the TracPygments plugin, accomplishing the following:
- the Pygments highlighter generates a Genshi event stream instead of a big string,
- the Mimeview component handles Genshi streams correctly, and supports putting individual lines in table rows,
- the Pygments support comes with a preference panel that allows the user to choose the highlighting theme, including live preview.
Some of this requires recent Genshi trunk.
The patches are more of a preview of what I'd like to see integrated for 0.11, not really a patch ready to be integrated. For example, the TracPygments patch is intended to be applied to the plugin. Also, a lot of details need to be refined.


