2020-09-07 14:02:09 +08:00
# Tutorials
2020-08-21 18:41:57 -07:00
2020-11-15 10:28:47 +08:00
This is list of publicly available Tutorials for using Mermaid.JS . This is intended as a basic introduction for the use of the Live Editor for generating diagrams, and deploying Mermaid.JS through HTML.
2020-10-28 00:20:35 -07:00
2021-05-02 01:49:40 -07:00
**Note that these tutorials might display an older interface, but the usage of the live-editor will largely be the same.**
2021-03-06 00:33:21 -08:00
2020-11-15 10:28:47 +08:00
For most purposes, you can use the [Live Editor ](https://mermaid-js.github.io/mermaid-live-editor ), to quickly and easily render a diagram.
2020-08-21 18:41:57 -07:00
2020-09-07 14:02:09 +08:00
## Live-Editor Tutorials
The definitions that can be generated the Live-Editor are also backwards-compatible as of version 8.7.0.
2020-08-21 18:41:57 -07:00
2021-05-02 01:49:40 -07:00
[Chris Chinchilla: Hands on - Text-based diagrams with Mermaid ](https://www.youtube.com/watch?v=4_LdV1cs2sA )
2020-10-14 14:41:15 +02:00
[GitLab Unfiltered: How to Create Mermaid Diagrams ](https://www.youtube.com/watch?v=SQ9QmuTHuSI&t=438s )
2020-08-21 18:41:57 -07:00
2020-10-14 14:41:15 +02:00
[GitLab Unfiltered: Emilie adds a mermaid diagram to the handbook ](https://www.youtube.com/watch?v=5RQqht3NNSE )
2020-08-21 18:41:57 -07:00
2020-10-14 14:41:15 +02:00
[World of Zero: I Learn How To Build Flowcharts and Signal Diagram's in Mermaid.JS ](https://www.youtube.com/watch?v=7_2IroEs6Is&t=207s )
2020-08-21 18:41:57 -07:00
2020-10-14 14:41:15 +02:00
[Eddie Jaoude: Can you code your diagrams? ](https://www.youtube.com/watch?v=9HZzKkAqrX8 )
2020-08-21 18:41:57 -07:00
2020-11-05 19:16:12 +01:00
## Mermaid with HTML
2021-09-29 19:02:34 +08:00
Examples are provided in [Getting Started ](n00b-gettingStarted.md )
2020-08-21 18:41:57 -07:00
2020-09-07 14:02:09 +08:00
**CodePen Examples:**
2020-08-21 18:41:57 -07:00
https://codepen.io/CarlBoneri/pen/BQwZzq
https://codepen.io/tdkn/pen/vZxQzd
https://codepen.io/janzeteachesit/pen/OWWZKN
2020-11-05 19:16:12 +01:00
## Mermaid with Text Area
2020-08-21 18:41:57 -07:00
2020-09-07 14:02:09 +08:00
https://codepen.io/Ryuno-Ki/pen/LNxwgR
2020-11-26 19:18:12 +01:00
2022-01-07 15:24:37 -08:00
## Mermaid in open source docs
[K8s.io Diagram Guide ](https://kubernetes.io/docs/contribute/style/diagram-guide/ )
[K8s.dev blog: Improve your documentation with Mermaid.js diagrams ](https://www.kubernetes.dev/blog/2021/12/01/improve-your-documentation-with-mermaid.js-diagrams/ )
2021-12-14 15:16:58 -08:00
## Jupyter Integration with mermaid-js
Here's an example of Python integration with mermaid-js which uses the mermaid.ink service, that displays the graph in a Jupyter notebook.
2020-11-26 19:18:12 +01:00
```python
import base64
2021-12-14 15:16:58 -08:00
from IPython.display import Image, display
2020-12-13 19:10:06 -03:00
import matplotlib.pyplot as plt
2020-11-26 19:18:12 +01:00
2021-12-14 15:16:58 -08:00
def mm(graph):
graphbytes = graph.encode("ascii")
base64_bytes = base64.b64encode(graphbytes)
base64_string = base64_bytes.decode("ascii")
display(Image(url="https://mermaid.ink/img/" + base64_string))
mm("""
2020-11-26 19:18:12 +01:00
graph LR;
A--> B & C & D;
B--> A & E;
C--> A & E;
D--> A & E;
E--> B & C & D;
2021-12-14 15:16:58 -08:00
""")
2020-11-26 19:18:12 +01:00
```
2020-12-13 19:10:06 -03:00
2020-11-26 19:18:12 +01:00
**Output**
2022-04-06 14:05:33 -04:00
![Example graph of the Python integration ](img/python-mermaid-integration.png )