Syntax Highlighting

The theme ships with a complete color map for Pygments, covering all common token types and adapting automatically to light mode.

Setup

Add these extensions to mkdocs.yml:

markdown_extensions:
  - pymdownx.highlight:
      anchor_linenums: true
      use_pygments: true
  - pymdownx.superfences
  - pymdownx.inlinehilite

Code blocks

Use standard fenced code blocks with an optional language identifier:

```python
def hello(name: str) -> str:
    """Return a greeting."""
    return f"Hello, {name}!"
```

Line numbers

```python linenums="1"
for i in range(10):
    print(i)
```

Highlight specific lines

```python hl_lines="2 3"
def example():
    x = 1      # highlighted
    y = 2      # highlighted
    return x + y
```

Inline code

Use backticks for inline code. The theme styles it with a pink color and a subtle background:

Call the `render()` method to update the view.

Copy button

Every code block gets a copy button that appears on hover. It uses the Clipboard API and shows a checkmark for 2 seconds after copying.

Supported languages

Pygments supports over 500 languages. Common ones: python, javascript, typescript, bash, yaml, json, html, css, sql, rust, go, java, cpp, markdown.

Admonitions

Admonitions use the palette as well:

!!! note "Note"
    Informational content.

!!! tip "Tip"
    A helpful tip.

!!! warning "Warning"
    Something to be careful about.

!!! danger "Danger"
    A critical warning.