Skip to main content

Highlighting themes for code blocks.

Project description

MkDocs Pygments

documentation gitter

Highlighting themes for code blocks.

Installation

This project is available to sponsors only, through my Insiders program. See Insiders explanation and installation instructions.

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.

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

mkdocs_pygments-0.0.2.tar.gz (32.8 kB view details)

Uploaded Source

Built Distribution

mkdocs_pygments-0.0.2-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: mkdocs_pygments-0.0.2.tar.gz
  • Upload date:
  • Size: 32.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.7

File hashes

Hashes for mkdocs_pygments-0.0.2.tar.gz
Algorithm Hash digest
SHA256 18f5f7e99c0cf7993c97998325eaa154f8d343cad0bb7c3c3a3dedc26d5f1489
MD5 2d0ba43e105ed6429a9b5b0916e5a1a9
BLAKE2b-256 642b162d4761f669a3a7624c805b7c73d6c1b49901387beef824c006923584b8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mkdocs_pygments-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 046230e2b64bd3425b5c7dae46f0617add5ed2eeabd72ac20a617406b18caa7b
MD5 5be06a64e83e173077d3d2e620110026
BLAKE2b-256 8633ecb56761b35b434d26a121fc37a5d1ac85fe517bbf34babf5ce056ab83ad

See more details on using hashes here.

Supported by

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