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

Download files

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

Source Distribution

mkdocs_pygments-0.1.0.tar.gz (28.3 kB view details)

Uploaded Source

Built Distribution

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

mkdocs_pygments-0.1.0-py3-none-any.whl (6.8 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for mkdocs_pygments-0.1.0.tar.gz
Algorithm Hash digest
SHA256 168572c1a01eaf8e08f2aee52b7220e3aaceeb7483c8f3968cf526b07141f892
MD5 dcfe8472f60f47efdf6ab19846b7b831
BLAKE2b-256 5c9f76064671f869d48d5f2c4cd73c6671d5d9800c70fbdad494f8267e423628

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mkdocs_pygments-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 38e5884e9ca39c6115a5abeb07fb6394fbd192e72c17a09c3def90720b1d1bea
MD5 ca8194468d845764a0fd94343156be8d
BLAKE2b-256 4324dc11d3cdacd0b3a35439766dc5972530bb8ebb8f6ec731043bd98f75121c

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 files

0.0.2

2 files

0.0.1

2 files

0.0.0

2 files

Supported by

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