How to fix Syntax Highlighting in Trac 0.11

Trac 0.11 and later uses Pygments to do syntax highlighting, IFF Pygments is installed. However even after installing Pygments, I could not get syntax highlighting to work.

While trying to figure this out I noticed the following error in my Firebug Console:

jQuery.loadStyleSheet is not a function

plus a couple of 404 errors (can’t remember the exact urls).

This reminded of a warning I’d seen on the trac website:

Important note: Please use either version 1.6, 2.4 or later of mod_wsgi. Versions prior to 2.4 in the 2.X branch have problems with some Apache configurations that use WSGI file wrapper extension. This extension is used in Trac to serve up attachments and static media files such as style sheets. If you are affected by this problem attachments will appear to be empty and formatting of HTML pages will appear not to work due to style sheet files not loading properly.

So I quickly upgraded to the latest mod_wsgi and restarted my apache, and lo, no more errors and syntax highlighting is working properly.

Advertisements