Metadata-Version: 2.5
Name: pygments-jennifer
Version: 0.1.0
Summary: Pygments lexer plugin for the Jennifer programming language
Project-URL: Homepage, https://jennifer-lang.dev/
Project-URL: Source, https://github.com/jennifer-language/pygments-jennifer
Author-email: mplx <mplx@jennifer-lang.dev>
License: BSD 2-Clause License
        
        Copyright (C) 2026 mplx <mplx@jennifer-lang.dev>
        
        Redistribution and use in source and binary forms, with or without
        modification, are permitted provided that the following conditions are met:
        
        1. Redistributions of source code must retain the above copyright notice, this
           list of conditions and the following disclaimer.
        
        2. Redistributions in binary form must reproduce the above copyright notice,
           this list of conditions and the following disclaimer in the documentation
           and/or other materials provided with the distribution.
        
        THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
        AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
        IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
        DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
        FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
        DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
        SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
        CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
        OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
        OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
License-File: LICENSE
Keywords: jennifer,lexer,pygments,syntax highlighting
Classifier: License :: OSI Approved :: BSD License
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Software Development :: Documentation
Classifier: Topic :: Text Processing :: Filters
Requires-Python: >=3.9
Requires-Dist: pygments>=2.13
Provides-Extra: test
Requires-Dist: pytest; extra == 'test'
Description-Content-Type: text/markdown

# pygments-jennifer

A [Pygments](https://pygments.org) lexer for [Jennifer](https://jennifer-lang.dev/),
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

```sh
pip install pygments-jennifer
```

Or the development version, from the repository:

```sh
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`:

```sh
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:

```rst
.. code-block:: jennifer

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

From Python:

```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/`](https://github.com/jennifer-language/jennifer/tree/main/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:

```sh
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](LICENSE).
