A Django template filter application to highlight code with Pygments
Project description
Django Pygmentify is a Django template filter application to highlight code with Pygments.
It is an alternative to Django Pygments, which hasn’t been updated in several years.
Install
$ pip install django-pygmentify
Add to settings.py.
INSTALLED_APPS = [
# ...
'pygmentify',
]
Usage
{% load pygmentify_tags %}
<link rel="stylesheet" href="{% pygmentify_css %}">
{% filter pygmentify %}
<pre class="python"><code>
print('Hello, world!')
</code></pre>
{% endpygmentify %}
Result:
<div class="highlight"><pre class="python"><code><span></span><span class="k">print</span><span class="p">(</span><span class="s2">"Hello, world!"</span><span class="p">)</span>
</code></pre></div>
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.