
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
.. image:: https://badge.fury.io/py/wagtail-pygments.svg :target: https://badge.fury.io/py/wagtail-pygments
A block render syntax highlighter for Wagtail CMS.
pip install -i wagtail-pygments
Use with StreamBlock
::
from wagtail_pygments.blocks import CodeBlock
class ContentStreamBlock(StreamBlock): heading = TextBlock() paragraph = TextBlock() code = CodeBlock(label='Code')
Use with StreamField
::
from wagtail_pygments.blocks import CodeBlock
class PostPage(Page): body = StreamField([ ('paragraph', RichTextBlock()), ('image', ImageChooserBlock()), ('embed', EmbedBlock()), ('code', CodeBlock()) ])
Example for django template::
{% load static %}
{% for block in page.body %} {% if block.block_type == "code" %} {{ block.value.code }} {% if block.value.caption %}
{{ block.value.caption }} {% endif %} {% else %} {{ block.value }} {% endif %} {% endfor %}Configuring WAGTAIL_CODE_BLOCK_LANGUAGES
in your Django settings::
WAGTAIL_CODE_BLOCK_LANGUAGES = (
('cpp', 'C++'),
('java', 'Java'),
('python3', 'Python 3'),
('bash', 'Bash/Shell'),
('javascript', 'Javascript'),
('css', "CSS"),
('html', "HTML"),
('julia', "Julia"),
('nginx', "Nginx configuration file"),
('numpy', "NumPy"),
('django', "Django"),
('jinja', "Jinja"),
('docker', "Docker"),
('jinja', "Jinja"),
('yaml', "YAML"),
('json', "JSON"),
('plpgsql', "PL/pgSQL"),
('psql', "PostgreSQL console (psql)"),
)
Can check full list in https://pygments.org/docs/lexers/
.
FAQs
A block render syntax highlighter for Wagtail CMS.
We found that wagtail-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
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.