File: plugins.rst

package info (click to toggle)
pygments 2.18.0%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 10,184 kB
  • sloc: python: 103,327; javascript: 238; makefile: 142; sh: 84; lisp: 74
file content (34 lines) | stat: -rw-r--r-- 1,069 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
=======
Plugins
=======

If you want to extend Pygments without hacking the sources, you can use
package `entry points`_ to add new lexers, formatters, styles or filters
as if they were in the Pygments core.

.. _entry points: https://packaging.python.org/en/latest/guides/creating-and-discovering-plugins/

The idea is to create a Python package, declare how extends Pygments,
and install it.

This will allow you to use your custom lexers/... with the
``pygmentize`` command. They will also be found by the lookup functions
(``lexers.get_lexer_by_name`` et al.), which makes them available to
tools such as Sphinx, mkdocs, ...


Defining plugins through entry points
=====================================

We have created a repository with a project template for defining your
own plugins.  It is available at

https://github.com/pygments/pygments-plugin-scaffolding


Extending The Core
==================

If you have written a Pygments plugin that is open source, please inform us
about that. There is a high chance that we'll add it to the Pygments
distribution.