The CodeHilite extension adds code/syntax highlighting to standard Python-Markdown code blocks using Pygments.
You must have pygments installed.
pip install Pygments
uv add Pygments
poetry add Pygments
Configuration
# mkdocs.yml
markdown_extensions:
- codehilite
Syntax
With the colon syntax (don't forget to indent the block).
:::python
import numpy as np
or backticks syntax
```python
import numpy as np
```
both give
import numpy as np