Skip to main content

pygments-ddot

Pygments lexer for ddot.it — a minimal text format for typed knowledge graphs.

Install

pip install pygments-ddot

The package registers itself via the pygments.lexers entry point, so both pygmentize and any tool that uses pygments.lexers.get_lexer_by_name will pick up ddot automatically.

Use

From the command line

pygmentize -l ddot -f html sample.ddot > sample.html
pygmentize -l ddot -f terminal sample.ddot

From Python

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

code = open("sample.ddot").read()
lexer = get_lexer_by_name("ddot")
print(highlight(code, lexer, HtmlFormatter()))

Aliases registered: ddot.it, ddot, ddotit. File pattern: *.ddot.

Token mapping

The lexer emits Pygments tokens chosen to map cleanly onto the canonical token vocabulary at ddot.it/test-data/tokens.md.

Pygments token Canonical name
Name.Class subject
Name.Function relation
Literal.String.Symbol object
Operator doubledot
Keyword.Pseudo command
Name.Attribute command-param
Comment.Preproc meta-delim
Punctuation meta-separator
Comment.Special.Operator meta-doubledot
Comment.Special.Relation meta-relation
Comment.Special.Object meta-object
Comment.Multiline meta-text
Literal.String.Backtick verbatim
Name.Label block-end
Comment.Single excluded

Conformance

The lexer is verified against the cross-implementation golden corpus — identical to the TextMate, Shiki, and Rouge ports. See tools/conformance-pygments.py.

npm run conformance:pygments      # or: python3 tools/conformance-pygments.py

Prerequisite: Pygments itself must be importable

The harness imports the lexer straight from this directory — it does not need pygments-ddot installed — but it does need the real Pygments library available to whichever python3 is on PATH. macOS system Python does not ship it.

From the repository root (where package.json lives; .venv/ is gitignored):

python3 -m venv .venv && .venv/bin/pip install pygments
PATH="$PWD/.venv/bin:$PATH" npm run conformance:pygments

If it fails with No module named 'pygments'

That error is misleading, and it does not mean the import path is wrong. conformance-pygments.py puts this repo's pygments/ directory on sys.path so it can import pygments_ddot. Because that directory is itself named pygments, Python registers it as a namespace package called pygments — which shadows the real library's name.

When the real Pygments is installed it wins, because a regular package (one with __init__.py) takes precedence over a namespace portion. When it is not installed, only the empty namespace portion remains, so import pygments succeeds while from pygments.token import ... fails — hence an error naming a module that appeared to import fine.

The fix is always to install Pygments, never to change sys.path.

The failure is loud: the script exits non-zero, so npm run conformance stops at this mirror rather than skipping it. A conformance run that does not mention Pygments has not verified it.

License

MIT

Metadata

Release files for pygments-ddot 0.1.2

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-ddot 0.1.2
File Size Uploaded Provenance Actions
pygments_ddot-0.1.2.tar.gz 8.1 kB With provenance Details for pygments_ddot-0.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pygments-ddot 0.1.2
File Interpreter ABI Platform Actions
pygments_ddot-0.1.2-py3-none-any.whl Python 3 none any Details for pygments_ddot-0.1.2-py3-none-any.whl

Total release size: 16.4 kB

Release files / pygments_ddot-0.1.2.tar.gz

Download URL pygments_ddot-0.1.2.tar.gz
Size 8.1 kB
Tags Source
SHA-256 checksum
How to use checksums
f169e9f5afd5d7fde80c61edbb9951ea3931c4bdba0d07a2c2f26a4afff17baf
BLAKE2b-256 checksum
How to use checksums
7699e46eb70bee00d92aef9ea98b61ce2c4c47ed173fc4629f372313c8a302d4
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 20, 2026.

Transparency log

Release files / pygments_ddot-0.1.2-py3-none-any.whl

Download URL pygments_ddot-0.1.2-py3-none-any.whl
Size 8.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
341a13adbff75a4126ebb806a52eee4b9f4e60e1f1f5b3da8ce2d01911ac5ca7
BLAKE2b-256 checksum
How to use checksums
7da64d300466cba6cad01566a018214efbf269578f150dcb2282d4b09950be30
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 20, 2026.

Transparency log

Security for pygments-ddot 0.1.2

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_ddot-0.1.2.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 20, 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.

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