Home

Pygments

Pygments is a syntax highlighting library for Python. It is designed to convert source code into highlighted markup in many formats for use in documentation, web pages, and terminals. The core design separates language identification from rendering: lexers parse input code into tokens, and formatters convert those tokens into a final presentation. This modular approach allows output in HTML with CSS styles, LaTeX, RTF, SVG, or ANSI-colored text for terminals, among others. Pygments ships with a large collection of lexers for programming languages, markup languages, and configuration formats, and it includes multiple style themes to control color schemes.

Pygments also provides a command-line interface through the pygmentize tool, enabling highlight of files or streams

directly
from
the
shell
or
within
other
tooling.
It
is
widely
used
by
documentation
systems
and
static
site
generators,
and
by
code
hosting
platforms
to
display
highlighted
code
blocks.
The
project
is
open
source
and
released
under
the
BSD
license,
inviting
community
contributions
and
extensions.
Pygments
can
be
extended
with
new
lexers
and
formatters,
and
its
design
supports
integration
with
Python
applications
and
build
pipelines.