A Django template tag to highlight code with Pygments
Project description
Django Pygmentify
*****************
|PyPI version|_ |Build status|_
.. |PyPI version| image::
https://badge.fury.io/py/django-pygmentify.svg
.. _PyPI version: https://pypi.python.org/pypi/django-pygmentify
.. |Build status| image::
https://travis-ci.org/richardcornish/django-pygmentify.svg?branch=master
.. _Build status: https://travis-ci.org/richardcornish/django-pygmentify
.. image:: https://raw.githubusercontent.com/richardcornish/django-pygmentify/master/docs/_static/img/screenshot.png
**Django Pygmentify** is a `Django <https://www.djangoproject.com/>`_ `template tag <https://docs.djangoproject.com/en/1.11/howto/custom-template-tags/>`_ application to highlight code with `Pygments <http://pygments.org/>`_.
It is an alternative to `Django Pygments <https://github.com/od-eon/django-pygments>`_, which hasn't been updated in several years.
* `Package distribution <https://pypi.python.org/pypi/django-pygmentify>`_
* `Code repository <https://github.com/richardcornish/django-pygmentify>`_
* `Documentation <https://django-pygmentify.readthedocs.io/>`_
* `Tests <https://travis-ci.org/richardcornish/django-pygmentify>`_
Install
=======
.. code-block:: bash
$ pip install django-pygmentify
Add to ``settings.py``.
.. code-block:: python
INSTALLED_APPS = [
# ...
'pygmentify',
]
Usage
=====
.. code-block:: django
{% load pygmentify_tags %}
<link rel="stylesheet" href="{% pygmentify_css %}">
{% pygmentify %}
<pre class="python">
print('Hello, world!')
</pre>
{% endpygmentify %}
Result:
.. code-block:: html
<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">"Hello, world!"</span><span class="p">)</span>
</pre></div>
Upgrading
=========
The syntax of the template tags `changed <https://github.com/richardcornish/django-pygmentify/commit/0e73db8f220304f9c496b7d43c2e1586bbaf59eb>`_ in version 0.3.0 from a template filter, ``{% filter pygmentify %}``, to a more robust template tag, ``{% pygmentify %}``. Consult the `documentation <https://django-pygmentify.readthedocs.io/en/latest/usage.html>`_ for usage instructions.
*****************
|PyPI version|_ |Build status|_
.. |PyPI version| image::
https://badge.fury.io/py/django-pygmentify.svg
.. _PyPI version: https://pypi.python.org/pypi/django-pygmentify
.. |Build status| image::
https://travis-ci.org/richardcornish/django-pygmentify.svg?branch=master
.. _Build status: https://travis-ci.org/richardcornish/django-pygmentify
.. image:: https://raw.githubusercontent.com/richardcornish/django-pygmentify/master/docs/_static/img/screenshot.png
**Django Pygmentify** is a `Django <https://www.djangoproject.com/>`_ `template tag <https://docs.djangoproject.com/en/1.11/howto/custom-template-tags/>`_ application to highlight code with `Pygments <http://pygments.org/>`_.
It is an alternative to `Django Pygments <https://github.com/od-eon/django-pygments>`_, which hasn't been updated in several years.
* `Package distribution <https://pypi.python.org/pypi/django-pygmentify>`_
* `Code repository <https://github.com/richardcornish/django-pygmentify>`_
* `Documentation <https://django-pygmentify.readthedocs.io/>`_
* `Tests <https://travis-ci.org/richardcornish/django-pygmentify>`_
Install
=======
.. code-block:: bash
$ pip install django-pygmentify
Add to ``settings.py``.
.. code-block:: python
INSTALLED_APPS = [
# ...
'pygmentify',
]
Usage
=====
.. code-block:: django
{% load pygmentify_tags %}
<link rel="stylesheet" href="{% pygmentify_css %}">
{% pygmentify %}
<pre class="python">
print('Hello, world!')
</pre>
{% endpygmentify %}
Result:
.. code-block:: html
<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">"Hello, world!"</span><span class="p">)</span>
</pre></div>
Upgrading
=========
The syntax of the template tags `changed <https://github.com/richardcornish/django-pygmentify/commit/0e73db8f220304f9c496b7d43c2e1586bbaf59eb>`_ in version 0.3.0 from a template filter, ``{% filter pygmentify %}``, to a more robust template tag, ``{% pygmentify %}``. Consult the `documentation <https://django-pygmentify.readthedocs.io/en/latest/usage.html>`_ for usage instructions.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file django-pygmentify-0.3.2.tar.gz.
File metadata
- Download URL: django-pygmentify-0.3.2.tar.gz
- Upload date:
- Size: 3.4 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
60a733f9d71cb0183d464fe528b8a68f8c8611bc0b3488c707b7223153d43d5d
|
|
| MD5 |
3c468c58f26e5bdce15950e540daeb73
|
|
| BLAKE2b-256 |
82941f7930ad358a2a58b7cb63c69e24308b704fc14c68d1fb278195f1fca7ae
|