1
1
# Docsify-mermaid-zoom
2
2
3
- A simple Docsify plugin enabling zoom in mermaid diagrams (and svg) .
3
+ A simple Docsify plugin enabling zoom in mermaid diagrams.
4
4
5
5
![ Demo] ( assets/demo.png )
6
6
@@ -10,23 +10,33 @@ A simple Docsify plugin enabling zoom in mermaid diagrams (and svg).
10
10
11
11
### Dependencies
12
12
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 )
15
15
16
16
Add the dependencies and plugin to ` index.html `
17
17
18
18
``` html
19
+ <script >
20
+ window .$docsify = {
21
+ ... ,
22
+ mermaidConfig: {
23
+ querySelector: " .mermaid" ,
24
+ }
25
+ ... ,
26
+ };
27
+ </script >
19
28
<!-- Import D3.js -->
20
29
<script src =" //cdn.jsdelivr.net/npm/d3@7" ></script >
21
30
<!-- Import Mermaid (⚠️ Maximum V9 for now)-->
22
31
<script src =" //cdn.jsdelivr.net/npm/mermaid@9/dist/mermaid.js" ></script >
23
32
<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 >
25
36
<!-- Import Docsify-mermaid-zoom -->
26
37
<script src =" //unpkg.com/docsify-mermaid-zoom/dist/docsify-mermaid-zoom.js" ></script >
27
38
```
28
39
29
- By default, zoom is only enabled on mermaid diagramms but can be use with others types of svg.
30
40
You can configure min/max scale and disable the zoom pannel.
31
41
32
42
The 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
37
47
38
48
### Optional configuration
39
49
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
+
40
54
``` html
41
55
<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 >
53
66
```
54
67
55
68
## License
0 commit comments