Skip to content


Subversion checkout URL

You can clone with
Download ZIP
pygments for django-admin, flatpages, templates and user data
Branch: master
Pull request Compare This branch is even with sniku:master.

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.


Complete syntax highlighting ( solution for django.

Can be used in templates as {% pygmentize 'html' %}html code here{%endpygmentize%}
or {{ var|pygmentize:"python" }} # where var is a snippet of python code
or {{ var|pygmentize_all }} # where var is a snippet of code with one or many {% pygmentize 'language' %} tags (useful for pygmentizing blog entries or user comments )
or in view:
code = "this is my code {% pygmentize 'python' %}some python code{%endpygmentize%}"
pygmentized_code = pygmentizer.pygmentize(code) # same as pygmentize_all filter but for view (useful for saving pygmentized content to db)

This app was developed mainly to enable syntax highlighting in blog posts and user comments,
but can be used to highlight any type of content. 

* pygments (easy_install pygments - if you have python setup-tools)

* copy pygmentize folder to your project root
* add pygmentize to your INSTALLED_APPS

That's it.
To change your pygment theme set PYGMENT_THEME variable in it's set to 'native' by default.
PYGMENT_THEME = 'my_theme'

If you are confused:
* examples and live demo:
* check the examples provided with the app
* mail me at pawel.suwala (a) 

Something went wrong with that request. Please try again.