Extensions
Codehilite

Codehilite

The CodeHilite extension adds code/syntax highlighting to standard Python-Markdown code blocks using 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