Skip to main content

pygments-jennifer

A Pygments lexer for Jennifer, packaged as a plugin. Once installed, Pygments highlights Jennifer wherever it is used: pygmentize, Sphinx, MkDocs, Jupyter, and any other tool built on it. Pygments takes new languages as plugins until they have a community of their own; this is that plugin.

Install

pip install pygments-jennifer

Or the development version, from the repository:

pip install git+https://github.com/jennifer-language/pygments-jennifer.git

Needs Python 3.9 or newer and Pygments 2.13 or newer, the first release that loads plugins through importlib.metadata. Install it into the same environment as the tool that runs Pygments (the Sphinx or MkDocs virtualenv, say).

Use

The lexer registers the alias jennifer, the filename pattern *.j and the MIME type text/x-jennifer:

pygmentize -l jennifer main.j          # by alias
pygmentize main.j                      # by file name
pygmentize -f html -O full -o main.html main.j

In Markdown for MkDocs (with pymdownx.highlight) or in Sphinx's MyST, fence code as ```jennifer. In reStructuredText:

.. code-block:: jennifer

   use io;
   io.printf("hello\n");

From Python:

from pygments import highlight
from pygments.formatters import HtmlFormatter
from pygments.lexers import get_lexer_by_name

html = highlight(source, get_lexer_by_name("jennifer"), HtmlFormatter())

guess_lexer recognises Jennifer by a #!... jennifer first line or a # pragma-jennifer-version: header, which extensionless scripts carry, and less surely by a use name; line.

Pygments' built-in Objective-J lexer claims *.j as well. With this plugin installed, a .j file name alone selects Jennifer; when Pygments also sees the source, it picks whichever lexer recognises the content, so an Objective-J file with its @import lines still goes to Objective-J.

What it highlights

The same token classes as the other Jennifer editor definitions: keywords and type keywords, $ variables, UPPER_CASE constants, CamelCase types, name( calls, ns.name with the prefix as a namespace (and the name after use or an alias), keyword-spelled names after a . or in a field position, # comments, nested /* */ comments, /** */ docblocks with @tags, # pragma-jennifer-...: and # lint-disable: directives, raw '...' and cooked "..." strings with escapes and {expr} slots, and the numeric forms.

Development

The lexer is maintained in the interpreter repository, at editors/pygments/, where it is checked against the interpreter's own lexer over every Jennifer source file in the project. src/pygments_jennifer/lexer.py, tests/example.j and tests/example.tokens are byte-for-byte copies of the files there. Change them there, then:

tools/sync.sh            # copy from a sibling checkout ../jennifer
tools/sync.sh --check    # what CI runs
python -m pip install -e ".[test]" && python -m pytest

Releasing

Set the version in pyproject.toml and src/pygments_jennifer/__init__.py, add it to CHANGELOG.md, commit, and push a tag of the same name (0.1.0, no v) to GitHub. CI builds the sdist and the wheel once the tests and the sync check pass, and publishes them to PyPI as a trusted publisher: the PyPI project trusts this repository's ci.yml, so no token is involved. A tag that does not match the version fails before anything is built.

License

BSD-2-Clause, like Pygments. See LICENSE.

Metadata

Release files for pygments-jennifer 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pygments-jennifer 0.1.0
File Size Uploaded Provenance Actions
pygments_jennifer-0.1.0.tar.gz 10.4 kB With provenance Details for pygments_jennifer-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pygments-jennifer 0.1.0
File Interpreter ABI Platform Actions
pygments_jennifer-0.1.0-py3-none-any.whl Python 3 none any Details for pygments_jennifer-0.1.0-py3-none-any.whl

Total release size: 18.0 kB

Release files / pygments_jennifer-0.1.0.tar.gz

Download URL pygments_jennifer-0.1.0.tar.gz
Size 10.4 kB
Tags Source
SHA-256 checksum
How to use checksums
df52a15de6f90cb981092706a83ac82d578addcb14dfda48080758deedca9b22
BLAKE2b-256 checksum
How to use checksums
2a9333a42e1c049a43c2fbaeb179644489021a9f278f43f5dc79d57551b36e60
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 22, 2026.

Transparency log

Release files / pygments_jennifer-0.1.0-py3-none-any.whl

Download URL pygments_jennifer-0.1.0-py3-none-any.whl
Size 7.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e23c716029c8442c325f626e25983aa0079343d0b0f55467f496922dfb0fab09
BLAKE2b-256 checksum
How to use checksums
3c32a99d496bf9ae26b8e459518a50f9a289b5301a305e7224ac402108a3e9a1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 22, 2026.

Transparency log

Security for pygments-jennifer 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for pygments_jennifer-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 22, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page