11# Docsify-mermaid-zoom
22
3- A simple Docsify plugin enabling zoom in mermaid diagrams (and svg) .
3+ A simple Docsify plugin enabling zoom in mermaid diagrams.
44
55![ Demo] ( assets/demo.png )
66
@@ -10,23 +10,33 @@ A simple Docsify plugin enabling zoom in mermaid diagrams (and svg).
1010
1111### Dependencies
1212
13- * [ mermaid-docsify] ( https://github.com/Leward/mermaid-docsify/] )
14- * [ D3.js] ( https://d3js.org )
13+ - [ mermaid-docsify] ( https://github.com/Leward/mermaid-docsify/] )
14+ - [ D3.js] ( https://d3js.org )
1515
1616Add the dependencies and plugin to ` index.html `
1717
1818``` html
19+ <script >
20+ window .$docsify = {
21+ ... ,
22+ mermaidConfig: {
23+ querySelector: " .mermaid" ,
24+ }
25+ ... ,
26+ };
27+ </script >
1928<!-- Import D3.js -->
2029<script src =" //cdn.jsdelivr.net/npm/d3@7" ></script >
2130<!-- Import Mermaid (⚠️ Maximum V9 for now)-->
2231<script src =" //cdn.jsdelivr.net/npm/mermaid@9/dist/mermaid.js" ></script >
2332<script src =" //unpkg.com/docsify-mermaid@latest/dist/docsify-mermaid.js" ></script >
24- <script >mermaid .initialize ({ startOnLoad: true }); </script >
33+ <script >
34+ mermaid .initialize ({ startOnLoad: true });
35+ </script >
2536<!-- Import Docsify-mermaid-zoom -->
2637<script src =" //unpkg.com/docsify-mermaid-zoom/dist/docsify-mermaid-zoom.js" ></script >
2738```
2839
29- By default, zoom is only enabled on mermaid diagramms but can be use with others types of svg.
3040You can configure min/max scale and disable the zoom pannel.
3141
3242The pannel provide ** two button** . The first button activates the zoom feature on the mermaid diagram. The second one allows to reset the zoom.
@@ -37,19 +47,22 @@ The diagram will return to its original scale once it leaves the viewport on you
3747
3848### Optional configuration
3949
50+ You can configure minimum zoom and maximum zoom.
51+
52+ You can also disable the zoom pannel. Zoom will still work if you double click on a diagramm.
53+
4054``` html
4155<script >
42- window .$docsify = {
43- ... ,
44- mermaidZoom: {
45- elementId: " .mermaid" ,
46- minimumScale: 1 ,
47- maximumScale: 5 ,
48- zoomPannel: true
49- },
50- ... ,
51- }
52- </script >
56+ window .$docsify = {
57+ ... ,
58+ mermaidZoom: {
59+ minimumScale: 1 ,
60+ maximumScale: 5 ,
61+ zoomPannel: true
62+ },
63+ ... ,
64+ }
65+ </script >
5366```
5467
5568## License
0 commit comments