Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

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>

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


Release history Release notifications

This version

0.0.1

Download files

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

Files for django-pygments-renderer, version 0.0.1
Filename, size File type Python version Upload date Hashes
Filename, size django_pygments_renderer-0.0.1-py3-none-any.whl (3.9 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size django-pygments-renderer-0.0.1.tar.gz (3.1 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page