MkDocs Plugin to enable pan & zoom on images and mermaid diagrams
Maintained. Last release 5 weeks ago, commits in 2 of the last 26 weeks. Weaker on commit activity and contributor spread.
pip install mkdocs-panzoom-pluginPanzoom for MkDocs
This plugin makes use of the panzoom (LICENCE) library by Andrei Kashcha
Setup
pip install mkdocs-panzoom-plugin
Add it to your mkdocs.yml:
plugins:
- search
- panzoom
[!WARNING] As of version 0.4.0 (performance optimizations) the following lines are needed:
markdown_extensions: - pymdownx.superfences: custom_fences: - name: mermaid class: mermaid format: !!python/name:pymdownx.superfences.fence_code_formatMake sure to define the
site_urlotherwise it won't work!Example:
site_url: https://playg0n.github.io/mkdocs-panzoom/
Usage
Examples and usage are available in the docs.
Config
Selectors
Mermaid and D2 are included by default, but you can add any arbitrary selector or exclude the default ones.
To enable images add the img tag like below.
[!WARNING]
exclude_selectorsis only to disable the default selectors[".mermaid", ".d2"]. If you want to exclude an item check exclude items.
plugins:
- panzoom:
include_selectors:
- .myClass # class in html
- "#myId" # id in html
- "img" # tag in html
exclude_selectors:
- ".mermaid"
- ".d2"
Exclude items
To exclude a single item add the class pz-ignore.
Example for an image
Hint
This makes the hint on how to use it permanently visible.
plugins:
- panzoom:
always_show_hint: true # default false