Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
jinja2-highlight
Readme
jinja2-highlight ################
A simple Jinja2 extension that uses Pygments to highlight code blocks.
.. image:: https://travis-ci.org/tlatsas/jinja2-highlight.svg?branch=master :target: https://travis-ci.org/tlatsas/jinja2-highlight
Github: https://github.com/tlatsas/jinja2-highlight
Pypi: http://pypi.python.org/pypi/jinja2-highlight
::
{% highlight 'language' %}
your-awesome-code-here
{% endhighlight %}
Replace language
with the appropriate Pygments lexer short name: http://pygments.org/docs/lexers/
Line numbering can be turned on using lineno='inline'
or lineno='table'
depending on the style of line numbering you want (as per Pygment's documentation: http://pygments.org/docs/formatters/#HtmlFormatter)
::
{% highlight 'language', lineno='inline' %}
your-awesome-code-here
{% endhighlight %}
This can also be used without a language setting
::
{% highlight lineno='table' %}
your-awesome-code-here
{% endhighlight %}
By default Pygments renders the code block inside a div with the class 'highlight', if you want to change the name you can set the environment variable jinja2_highlight_cssclass
to the class name you would like.
In jinja this can be done after you've created your environment; ::
env = Environment(extensions=['jinja2_highlight.HighlightExtension'])
# Set the css class name to 'codehilite'
env.extend(jinja2_highlight_cssclass = 'codehilite')
In Flask this can be done with the following (after creating your app): ::
app.jinja_env.extend(jinja2_highlight_cssclass = 'codehilite')
See the example at: https://github.com/tlatsas/jinja2-highlight/tree/master/examples/flask
FAQs
Jinja2 extension to highlight source code using Pygments
We found that jinja2-highlight 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
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.