Skip to main content

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>

Project details


Download files

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

Source Distribution

django-pygmentify-0.3.7.tar.gz (52.7 kB view details)

Uploaded Source

Built Distribution

django_pygmentify-0.3.7-py2.py3-none-any.whl (47.2 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file django-pygmentify-0.3.7.tar.gz.

File metadata

  • Download URL: django-pygmentify-0.3.7.tar.gz
  • Upload date:
  • Size: 52.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/39.2.0 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/2.7.15

File hashes

Hashes for django-pygmentify-0.3.7.tar.gz
Algorithm Hash digest
SHA256 b0b705c12e488973469eb3d7587eaf3a0b0d105a0bd3f48277f1cf35ba0132af
MD5 6eaf8d2592281403273ab195d04f2d6f
BLAKE2b-256 4d284a063ec256e2f40c399ee01d2399afa195e83632b3909075af4b6d8b1c2c

See more details on using hashes here.

File details

Details for the file django_pygmentify-0.3.7-py2.py3-none-any.whl.

File metadata

  • Download URL: django_pygmentify-0.3.7-py2.py3-none-any.whl
  • Upload date:
  • Size: 47.2 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/39.2.0 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/2.7.15

File hashes

Hashes for django_pygmentify-0.3.7-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 c5562728b8fa5ecc5e48514c98827562a8c10d4455f83934579487983e032467
MD5 7b9489eea167ca26c4e040d852914bd7
BLAKE2b-256 10e6de5d1e0649acc562a6971a3cb3b92b2b5ab164870034097fd13812a02680

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page