Skip to main content

MkDocs Pygments

ci documentation pypi version gitter

Highlighting themes for code blocks.

Installation

pip install mkdocs-pygments

Usage

Configure it in mkdocs.yml:

# mkdocs.yml
plugins:
- pygments:
    light: autumn
    dark: github-dark

To know which themes are available, you can either read our docs, or use a theme that doesn't exist, to abort the build with an error and a message listing the available themes:

# mkdocs.yml
plugins:
- pygments:
    light: wodjweofijwqefd
    dark: github-dark
$ mkdocs serve
INFO    -  Building documentation...
INFO    -  Cleaning site directory
ERROR   -  pygments: Unknown theme: 'wodjweofijwqefd'. Available themes:
           abap, algol, algol_nu, arduino, autumn, bw, borland, coffee,
           colorful, default, dracula, emacs, friendly_grayscale, friendly,
           fruity, github-dark, gruvbox-dark, gruvbox-light, igor, inkpot,
           lightbulb, lilypond, lovelace, manni, material, monokai, murphy,
           native, nord-darker, nord, one-dark, paraiso-dark, paraiso-light,
           pastie, perldoc, rainbow_dash, rrt, sas, solarized-dark,
           solarized-light, staroffice, stata-dark, stata-light,
           tango, trac, vim, vs, xcode, zenburn

It's possible to instruct MkDocs Pygments to ignore the background color set by a theme, in order to make it work for both light and dark color schemes.

For example, to use the autumn style (which is a light theme), for both light and dark schemes while adapting the background color:

# mkdocs.yml
plugins:
- pygments:
    light: autumn
    respect_light_background: true  # default value
    dark: autumn
    respect_dark_background: false

To use the github-dark style (which is a dark theme), for both light and dark schemes while adapting the background color:

# mkdocs.yml
plugins:
- pygments:
    light: github-dark
    respect_light_background: false
    dark: github-dark

By default, the background color is respected, so you don't have to actually specify respect_<light/dark>_background: true.

Sponsors

Metadata

Release files for mkdocs-pygments 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mkdocs-pygments 0.1.1
File Size Uploaded
mkdocs_pygments-0.1.1.tar.gz 29.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mkdocs-pygments 0.1.1
File Interpreter ABI Platform
mkdocs_pygments-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 38.8 kB

Release files / mkdocs_pygments-0.1.1.tar.gz

Download URL mkdocs_pygments-0.1.1.tar.gz
Size 29.8 kB
Tags Source
SHA-256 checksum
How to use checksums
5bd4a2260a212dc1ba32899e4487be3e4641649d5e8ae024ebbbb15b87ebbae0
BLAKE2b-256 checksum
How to use checksums
00560a55e66e1cd6f037731733bf9ec3efd05a54ba6fcf84bf61dfad9be368e1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.8

Release files / mkdocs_pygments-0.1.1-py3-none-any.whl

Download URL mkdocs_pygments-0.1.1-py3-none-any.whl
Size 9.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2ab3dc5d73a8945a8f9a229c6a229297ebf784be0b3921262e50d7f5da923058
BLAKE2b-256 checksum
How to use checksums
161a0fbe319849a4a15e93311a61bfaf8998d03ec8db5f660c17ff11988ed3e7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.8

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

0.0.2

2 release files

0.0.1

2 release files

0.0.0

2 release files

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