Stefan Scherfke

A BeautifulSoup with Django and Pygments

Just added syntax highlighting using BeautifulSoup and Pygments. I took the SaltyCrane Blog for inspiration, but in contrast to it, I implemented it as a template filter in a separate application. This is surely not the most performant way, but I’m planning to use memcache, so I think this is ok.

Here an example how to use the filter:

{% load highlight_code %}
{{ my_var_with_code|highlight|safe }}