mkdocs-shadcn

  • Home
  • Get started
  • Pages
Extensions
  • Admonitions
  • Attribute Lists
  • Codehilite
  • Codexec New
  • Apache ECharts Alpha
  • Fenced code
  • Footnotes
  • Iconify
  • pymdownx.arithmatex
  • pymdownx.blocks.details
  • pymdownx.blocks.tab
  • pymdownx.progressbar
  • pymdownx.tabbed
Plugins
  • Excalidraw Alpha
  • Mkdocstrings Alpha

Codehilite

Previous Next

Syntax highlighting for code blocks

Reference

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
Attribute Lists Codexec
Menu
Home Get started Pages
Extensions
Admonitions Attribute Lists Codehilite Codexec Apache ECharts Fenced code Footnotes Iconify pymdownx.arithmatex pymdownx.blocks.details pymdownx.blocks.tab pymdownx.progressbar pymdownx.tabbed
Plugins
Excalidraw Mkdocstrings

On This Page

Configuration Syntax
Built by Alban Siffer — shadcn theme provided by @asiffer