MkDocs PanZoom Plugin

0.5.2 · active · verified Sat Apr 11

The MkDocs PanZoom Plugin is an active MkDocs plugin, currently at version 0.5.2, designed to add pan and zoom functionality to images and Mermaid/D2 diagrams within your MkDocs generated documentation. It enhances user interaction with visual content by allowing navigation and magnification, and it maintains a steady release cadence with recent updates improving performance and features.

Warnings

Install

Quickstart

To activate the plugin, add `panzoom` to your `plugins` list in `mkdocs.yml`. For Mermaid and D2 diagrams to work correctly with pan/zoom since version 0.4.0, you must also configure `pymdownx.superfences` under `markdown_extensions` and define your `site_url`. The example demonstrates enabling pan/zoom for images, showing the hint permanently, setting an initial zoom, and configuring `pymdownx.superfences`.

plugins:
  - search
  - panzoom:
      # Enable pan/zoom for images
      include_selectors:
        - "img"
      # Optional: always show the hint (default: false)
      always_show_hint: true
      # Optional: set initial zoom level (default: 1.0)
      initial_zoom_level: 1.2
      # Optional: enable fullscreen (still in development)
      full_screen: False

# Required for Mermaid/D2 diagrams with panzoom since v0.4.0
markdown_extensions:
  - pymdownx.superfences:
      custom_fences:
        - name: mermaid
          class: mermaid
          format: !!python/name:pymdownx.superfences.fence_code_format

site_url: https://example.com/your-docs/

view raw JSON →