Skip to main content

Highlighting themes for code blocks.

Project description

MkDocs Pygments

documentation gitpod 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.1.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

mkdocs_pygments-0.0.1-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: mkdocs_pygments-0.0.1.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.11.5

File hashes

Hashes for mkdocs_pygments-0.0.1.tar.gz
Algorithm Hash digest
SHA256 eb4dae4f1c492adf69457c43e4b5813a1af9323db110a48e00d75a92b54d20c3
MD5 745cdd0407ab7ab157202d5284e5a25f
BLAKE2b-256 9f66a328a28898c594396bee3427df1031d23f86aafd7a88918bcac8347d28f1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mkdocs_pygments-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d3c2534c29f1c8ae2d67e49f6e474c4d854ef72baa4a9577d5190d2bcad411ce
MD5 88582509a669c79dca886fb26c81f580
BLAKE2b-256 60871366bb4a0db37204e0a0ab60aafcb1a0acbe0090f0c8a50660771991e864

See more details on using hashes here.

Supported by

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