Skip to content

Commit c034fb5

Browse files
Merge pull request #4 from corentinleberre/poc-update-docsify
👽 Update plugin to make it work with Mermaid V10
2 parents c67323b + cb53776 commit c034fb5

File tree

11 files changed

+781
-550
lines changed

11 files changed

+781
-550
lines changed

.github/workflows/static.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
uses: actions/upload-pages-artifact@v1
3737
with:
3838
# Upload entire repository
39-
path: './demo'
39+
path: "./demo"
4040
- name: Deploy to GitHub Pages
4141
id: deployment
4242
uses: actions/deploy-pages@v1

README.md

Lines changed: 29 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
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

1616
Add 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.
3040
You can configure min/max scale and disable the zoom pannel.
3141

3242
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
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

demo/index.html

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,15 @@
1818
<div id="app"></div>
1919
<script>
2020
window.$docsify = {
21-
name: "Docsify-mermaid-zoom"
21+
name: "Docsify-mermaid-zoom",
22+
mermaidConfig: {
23+
querySelector: ".mermaid",
24+
},
25+
mermaidZoom: {
26+
minimumScale: 1,
27+
maximumScale: 5,
28+
zoomPannel: true,
29+
},
2230
};
2331
</script>
2432
<!-- Docsify v4 -->
@@ -28,7 +36,9 @@
2836
<!-- Import Mermaid -->
2937
<script src="//unpkg.com/mermaid/dist/mermaid.js"></script>
3038
<script src="//unpkg.com/docsify-mermaid@latest/dist/docsify-mermaid.js"></script>
31-
<script>mermaid.initialize({ startOnLoad: true });</script>
39+
<script>
40+
mermaid.initialize({ startOnLoad: true });
41+
</script>
3242
<!-- Import Docsify-mermaid-zoom -->
3343
<script src="//unpkg.com/docsify-mermaid-zoom/dist/docsify-mermaid-zoom.js"></script>
3444
</body>

0 commit comments

Comments
 (0)