Registry / web-framework / mkdocs-panzoom-plugin

mkdocs-panzoom-plugin

JSON →
library0.5.2pypypiunverified

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.

pip install mkdocs-panzoom-plugin
INSTALL
IMPORT
SIG · MKDOCS-PANZOOM-PLU
M
mkdocs-panzoom-plugin
web-frameworkpythonv0.5.2
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

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/
mkdocs --version
Debug
Known issues
breakingAs of version 0.4.0, the plugin requires explicit configuration of `pymdownx.superfences` for Mermaid/D2 diagrams to work, and the `site_url` must be defined in `mkdocs.yml`. Additionally, the `exclude` (pages) configuration option was removed.
fix
Add `markdown_extensions` for `pymdownx.superfences` as shown in the quickstart, ensure `site_url` is set, and use the `pz-ignore` class for individual exclusions instead of `exclude` pages option.
affects: >=0.4.0
gotchaThe `site_url` parameter in `mkdocs.yml` must be defined for the plugin to function correctly, particularly with diagram and image handling.
fix
Ensure `site_url: https://your-domain.com/your-docs/` is present and correctly configured in your `mkdocs.yml`.
affects: >=0.4.0
gotchaThe `exclude_selectors` option in the plugin configuration is intended only to disable the *default* selectors (e.g., '.mermaid', '.d2'). To exclude a *specific item* (image or diagram) from pan/zoom, you must add the CSS class `pz-ignore` to that item in your Markdown.
fix
For specific item exclusion, apply the `pz-ignore` class directly to the HTML element or Markdown that generates it. E.g., `![Alt text](image.png){.pz-ignore}`.
affects: All
Errors
Common errors & fixes
Make sure to define the site_url otherwise it won't work!
The `mkdocs-panzoom-plugin` requires the `site_url` parameter to be explicitly defined in your `mkdocs.yml` configuration file for the plugin to function correctly, particularly for proper path resolution and asset loading.
fix
Add or ensure the `site_url` is correctly defined in your `mkdocs.yml` file, pointing to the base URL of your documentation site. Example: `site_url: https://your-domain.com/your-docs/`
Mermaid/D2 diagrams not working with pan and zoom (after plugin v0.4.0+)
As of `mkdocs-panzoom-plugin` version 0.4.0, Mermaid and D2 diagrams require explicit configuration of `pymdownx.superfences` under `markdown_extensions` in `mkdocs.yml` for the pan and zoom functionality to apply.
fix
Add the `pymdownx.superfences` extension and its `custom_fences` configuration for Mermaid in your `mkdocs.yml` file under `markdown_extensions`. Example: `markdown_extensions: - pymdownx.superfences: custom_fences: - name: mermaid class: mermaid format: !!python/name:pymdownx.superfences.fence_code_format`
mkdocs-panzoom-plugin exclude pages option not working
The `exclude` (pages) configuration option was removed in `mkdocs-panzoom-plugin` version 0.4.0. To exclude specific images or diagrams, you must now apply a CSS class directly to the item in your Markdown.
fix
Instead of using the `exclude` configuration option, add the `pz-ignore` class directly to the image or diagram you wish to exclude in your Markdown. Example: `![Alt text](image.png){.pz-ignore}`
[Bug] Selectors overwrite eachother
There is a reported bug where if both `include_selectors` and `exclude_selectors` are configured with overlapping conditions, the `include_selectors` may inadvertently override the `exclude_selectors`.
fix
Carefully review and refine your `include_selectors` and `exclude_selectors` to prevent overlaps. Prefer using the `pz-ignore` class for specific item exclusions where possible, or adjust selectors to be mutually exclusive. If the bug persists, you may need to rely on more granular CSS targeting or report the issue to the plugin maintainer.
Upgrade
Version history
0.5.2latest on PyPI · released Dec 22, 2025
Audit
Dependencies
mkdocsrequiredCore dependency for any MkDocs plugin.
pymdownx-superfencesoptionalRequired for proper rendering and panzoom functionality of Mermaid and D2 diagrams since v0.4.0.
Agent activity
7 hits · last 30 days
node
6
Resources
mkdocs-panzoom-plugin — pip install mkdocs-panzoom-plugin · libregistry