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
File details
Details for the file django-pygmentify-0.3.4.tar.gz.
File metadata
- Download URL: django-pygmentify-0.3.4.tar.gz
- Upload date:
- Size: 3.4 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
df29f4083a018a99ade74fbc4db4a9a07bdde03e6867de26cb11cb0da31b0dea
|
|
| MD5 |
e53b5136835315ec468c2e6001f977f1
|
|
| BLAKE2b-256 |
7957980d855172263ba5ca5fbdaa870ce3a706049508f4e447784906175f92cd
|