-
Notifications
You must be signed in to change notification settings - Fork 348
/
Copy pathmermaid.py
66 lines (52 loc) · 1.03 KB
/
mermaid.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# /// script
# requires-python = ">=3.11"
# dependencies = [
# "marimo",
# ]
# ///
import marimo
__generated_with = "0.8.19"
app = marimo.App()
@app.cell
def __():
import marimo as mo
return (mo,)
@app.cell
def __(mo):
mo.mermaid(
"""
graph TD
A[Enter Chart Definition] --> B(Preview)
B --> C{decide}
C --> D[Keep]
C --> E[Edit Definition]
E --> B
D --> F[Save Image and Code]
F --> B
"""
).center()
return
@app.cell
def __(mo):
graph = mo.ui.code_editor(
value="""sequenceDiagram
Alice->>John: Hello John, how are you?
John-->>Alice: Great!
Alice-)John: See you later!""",
language="mermaid",
label="Mermaid editor",
)
graph
return (graph,)
@app.cell
def __(graph, mo):
mo.md(
f"""
You can render mermaid directly inside `mo.md`. Using
`mo.mermaid()`
{mo.mermaid(graph.value)}
"""
)
return
if __name__ == "__main__":
app.run()