MkDocs Pygments
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)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| mkdocs_pygments-0.1.1.tar.gz | 29.8 kB | Without provenance | Details for mkdocs_pygments-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mkdocs_pygments-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for mkdocs_pygments-0.1.1-py3-none-any.whl |
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
|
Security for mkdocs-pygments 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.