A Django template tag to highlight code with Pygments
Project description
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">"Hello, world!"</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.
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.
Source Distribution
Built Distribution
Close
Hashes for django_pygmentify-0.3.5-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b86d4c93e70027de91b43cb48cd600fc1bc446eaf355b4aedd6e7cd1a5ba4ae6 |
|
MD5 | c7459b18acd86f1dfe84482f9e5eec4f |
|
BLAKE2b-256 | e37beb5a2dc42f4ae87dc4d55bb18234889bc7ef3c5791223353c326045416ec |