
Security News
npm ‘is’ Package Hijacked in Expanding Supply Chain Attack
The ongoing npm phishing campaign escalates as attackers hijack the popular 'is' package, embedding malware in multiple versions.
Django app that provides a template tag and 2 filters for doing syntax highlighting with Pygments
"django-pygments" is a Django app that provides a template tag and two filters for doing syntax highlighting with Pygments.
The project is also available on PyPI:
pip install django-pygments
<pre lang="python">....</pre>
See the view and demo template for examples on how to use the
"pygmentify" and "pygmentify_inline" filters (the latter is rather
useful for RSS feeds, because it inlines CSS styles by passing
noclasses=True
to pygments.formatters.HtmlFormatter
) or the
"pygment" tag.
While using the "pygment" template tag, you can pass keyword arguments that you would pass to Pygments HtmlFormatter class constructor by passing them as with keyword arguments along with the pygment tag. Look at demo template for examples. There is one caveat with this feature still. You can only pass Python values as argument values (like strings wrapped within quotes or True or False boolean values, etc.). It doesn't support Django template/context variables as arguments yet.
E.g: to disable line numbering, use:
{% pygment linenos=False %}
<pre lang="python">...</pre>
{% endpygment %}
3-clause BSD
FAQs
Django app that provides a template tag and 2 filters for doing syntax highlighting with Pygments
We found that django-pygments demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The ongoing npm phishing campaign escalates as attackers hijack the popular 'is' package, embedding malware in multiple versions.
Security News
A critical flaw in the popular npm form-data package could allow HTTP parameter pollution, affecting millions of projects until patched versions are adopted.
Security News
Bun 1.2.19 introduces isolated installs for smoother monorepo workflows, along with performance boosts, new tooling, and key compatibility fixes.