Skip to main content

Pygments lexer for ddot.it (Knowledge Graph Notation).

Project description

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 operator
Keyword.Pseudo command
Comment.Preproc meta-delim
Comment.Special.Operator meta-operator
Comment.Special.Relation meta-relation
Comment.Special.Object meta-object
Comment.Multiline meta-text
Comment.Single disabled

Conformance

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

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pygments_ddot-0.1.0.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pygments_ddot-0.1.0-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

Details for the file pygments_ddot-0.1.0.tar.gz.

File metadata

  • Download URL: pygments_ddot-0.1.0.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for pygments_ddot-0.1.0.tar.gz
Algorithm Hash digest
SHA256 c9d88afc12734ff96172b88abeb1bfd1219f6c35a44f42d9e63c171a02748ff4
MD5 c6e7908bdc5c8e199b83dec6cd69a356
BLAKE2b-256 fa5a9b38ff76343656239ec5f9d5ef6b28303ff725a9e6160d3ed141883252bd

See more details on using hashes here.

File details

Details for the file pygments_ddot-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: pygments_ddot-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for pygments_ddot-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0c2817278de4a816c703c38ce168d9eaf58501cf9af49122c074a70972211071
MD5 042d8bc1c0bae0a17ef596b14f1febc6
BLAKE2b-256 8850195b2ad369d168f724bf1e5f26fa9c0e5be873eedd9f997478c075fcba95

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page