Skip to main content

Provides functionality for syntax highlighting using Pygments.

Project description

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 ).

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-pygments-renderer-0.0.1.tar.gz (3.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_pygments_renderer-0.0.1-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

File details

Details for the file django-pygments-renderer-0.0.1.tar.gz.

File metadata

  • Download URL: django-pygments-renderer-0.0.1.tar.gz
  • Upload date:
  • Size: 3.1 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for django-pygments-renderer-0.0.1.tar.gz
Algorithm Hash digest
SHA256 b5548e94ea13271b87d2425768ec76f8062ea62032191999dbbe227a72cc1259
MD5 f8ed9aaf18958d4d0b82973b88f6c621
BLAKE2b-256 649184a73b7f112af7ba11dcd24e14aa4e4ff02d3bedcd0b1a2b4c36a84b9c1e

See more details on using hashes here.

File details

Details for the file django_pygments_renderer-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: django_pygments_renderer-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 3.9 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for django_pygments_renderer-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 de503a87162e6bd0241fe164018108c484ff7a904ecb5759087c31f91541c3b6
MD5 deff8067984627276571f370ebd8bed6
BLAKE2b-256 f5bc8de080c5094143ce2ecb06b6fa9886bdec49c166ca68607510c775a1f35d

See more details on using hashes here.

Supported by

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