Skip to main content

django-pygments-renderer

Provides functionality for syntax highlighting using Pygments .

./example.png

Installation

django-pygments-renderer requires python 3.6 or later and Django 2.0 or later.

$ python3 -m pip install django-pygments-renderer

https://pypi.org/project/django-pygments-renderer/

Usage

INSTALLED_APPS += [
    'pygments_renderer',
]
{% load i18n %}
{% load pygmentize %}
<html>
<head>
    <title>{{ snippet.title}} - djangosnippets</title>
    <style>{% pygments_css %}</style>
    <!-- other header tags -->
</head>

<body>
   <div class="container">
       <h2 class="title">{{ snippet.title }} by {{ snippet.created_by.username }}</h2>

       <div class="sourcecode">
           {{ snippet.code|pygmentize:"python3" }}
       </div>

       <div>
           {{ snippet.description }}
       </div>
   </div>
</body>
</html>

Similar projects

Development

  • lint: tox -e flake8 or flake8

  • test: tox -e py37 or DJANGO_SETTINGS_MODULE=test_settings python -m django test

License

This software is licensed under the MIT License (See LICENSE ).

Metadata

Release files for django-pygments-renderer 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-pygments-renderer 0.0.1
File Size Uploaded
django-pygments-renderer-0.0.1.tar.gz 3.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-pygments-renderer 0.0.1
File Interpreter ABI Platform
django_pygments_renderer-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 7.0 kB

Release files / django-pygments-renderer-0.0.1.tar.gz

Download URL django-pygments-renderer-0.0.1.tar.gz
Size 3.1 kB
Tags Source
SHA-256 checksum
How to use checksums
b5548e94ea13271b87d2425768ec76f8062ea62032191999dbbe227a72cc1259
BLAKE2b-256 checksum
How to use checksums
649184a73b7f112af7ba11dcd24e14aa4e4ff02d3bedcd0b1a2b4c36a84b9c1e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.2

Release files / django_pygments_renderer-0.0.1-py3-none-any.whl

Download URL django_pygments_renderer-0.0.1-py3-none-any.whl
Size 3.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
de503a87162e6bd0241fe164018108c484ff7a904ecb5759087c31f91541c3b6
BLAKE2b-256 checksum
How to use checksums
f5bc8de080c5094143ce2ecb06b6fa9886bdec49c166ca68607510c775a1f35d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.2

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page