Provides functionality for syntax highlighting using Pygments .
django-pygments-renderer requires python 3.6 or later and Django 2.2 or later.
$ python3 -m pip install django-pygments-renderer
https://pypi.org/project/django-pygments-renderer/
INSTALLED_APPS += [
'pygments_renderer',
]
{% load i18n %}
{% load pygmentize %}
<html>
<head>
<title>{{ title }}</title>
<style>{% pygments_css %}</style> <!-- load css for pygments -->
</head>
<body>
<div class="container">
<div class="sourcecode">
{{ code|pygmentize:"python3" }} <!-- highlighting -->
</div>
</div>
</body>
</html>
- https://github.com/richardcornish/django-pygmentify
- https://github.com/odeoncg/django-pygments
- https://github.com/sniku/django-pygments
- lint:
tox -e flake8
orflake8
- test:
tox -e py39
orDJANGO_SETTINGS_MODULE=test_settings python -m django test
This software is licensed under the MIT License (See LICENSE ).