Skip to main content
Help us improve PyPI by participating in user testing. All experience levels needed!

A Django template tag to highlight code with Pygments

Project description

PyPI version Build status

https://raw.githubusercontent.com/richardcornish/django-pygmentify/master/docs/_static/img/screenshot.png

Django Pygmentify is a Django template tag 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 %}">

{% pygmentify %}
<pre class="python">
print('Hello, world!')
</pre>
{% endpygmentify %}

Result:

<link rel="stylesheet" href="/static/pygmentify/css/default.min.css">

<div class="highlight"><pre class="python"><span></span><span class="k">print</span><span class="p">(</span><span class="s2">&quot;Hello, world!&quot;</span><span class="p">)</span>
</pre></div>

Upgrading

The syntax of the template tags changed in version 0.3.0 from a template filter, {% filter pygmentify %}, to a more robust template tag, {% pygmentify %}. Consult the usage documentation for instructions.

Release history Release notifications

This version
History Node

0.3.5

History Node

0.3.4

History Node

0.3.3

History Node

0.3.2

History Node

0.3.1

History Node

0.3.0

History Node

0.2.4

History Node

0.2.3

History Node

0.2.2

History Node

0.2.1

History Node

0.2

History Node

0.1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
django_pygmentify-0.3.5-py2.py3-none-any.whl (48.5 kB) Copy SHA256 hash SHA256 Wheel py2.py3 Jul 17, 2017
django-pygmentify-0.3.5.tar.gz (3.4 MB) Copy SHA256 hash SHA256 Source None Jul 17, 2017

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page