mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-01-21 06:53:17 +08:00
451 lines
9.7 KiB
HTML
451 lines
9.7 KiB
HTML
<html>
|
|
<head>
|
|
<link href="https://fonts.googleapis.com/css?family=Montserrat&display=swap" rel="stylesheet" />
|
|
<link href="https://unpkg.com/tailwindcss@^1.0/dist/tailwind.min.css" rel="stylesheet" />
|
|
<link
|
|
rel="stylesheet"
|
|
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"
|
|
/>
|
|
<link
|
|
href="https://cdn.jsdelivr.net/npm/@mdi/font@6.9.96/css/materialdesignicons.min.css"
|
|
rel="stylesheet"
|
|
/>
|
|
<link
|
|
href="https://fonts.googleapis.com/css?family=Noto+Sans+SC&display=swap"
|
|
rel="stylesheet"
|
|
/>
|
|
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
|
<link
|
|
href="https://fonts.googleapis.com/css2?family=Kalam:wght@300;400;700&display=swap"
|
|
rel="stylesheet"
|
|
/>
|
|
<link
|
|
href="https://fonts.googleapis.com/css2?family=Caveat:wght@400..700&family=Kalam:wght@300;400;700&family=Rubik+Mono+One&display=swap"
|
|
rel="stylesheet"
|
|
/>
|
|
<link
|
|
href="https://fonts.googleapis.com/css2?family=Kalam:wght@300;400;700&family=Rubik+Mono+One&display=swap"
|
|
rel="stylesheet"
|
|
/>
|
|
|
|
<style>
|
|
body {
|
|
/* background: rgb(221, 208, 208); */
|
|
/* background: #333; */
|
|
font-family: 'Arial';
|
|
/* font-size: 18px !important; */
|
|
}
|
|
h1 {
|
|
color: grey;
|
|
}
|
|
.mermaid2 {
|
|
display: none;
|
|
}
|
|
.mermaid svg {
|
|
/* font-size: 18px !important; */
|
|
|
|
/* background-color: #efefef;
|
|
background-image: radial-gradient(#fff 51%, transparent 91%),
|
|
radial-gradient(#fff 51%, transparent 91%);
|
|
background-size: 20px 20px;
|
|
background-position:
|
|
0 0,
|
|
10px 10px;
|
|
background-repeat: repeat; */
|
|
}
|
|
.malware {
|
|
position: fixed;
|
|
bottom: 0;
|
|
left: 0;
|
|
right: 0;
|
|
height: 150px;
|
|
background: red;
|
|
color: black;
|
|
display: flex;
|
|
display: flex;
|
|
justify-content: center;
|
|
align-items: center;
|
|
font-family: monospace;
|
|
font-size: 72px;
|
|
}
|
|
/* tspan {
|
|
font-size: 6px !important;
|
|
} */
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<h4>Case 1</h4>
|
|
<div class="flex">
|
|
<pre id="diagram" class="mermaid">
|
|
stateDiagram-v2
|
|
AState: Should NOT be white
|
|
BState
|
|
classDef exampleStyleClass fill:#fff,color: blue;
|
|
class AState,BState exampleStyleClass
|
|
style AState fill:#636,border:1px solid red,color:white;
|
|
</pre>
|
|
<pre id="diagram" class="mermaid">
|
|
%%{init: {"look": "classic"} }%%
|
|
stateDiagram-v2
|
|
AState: Should NOT be white
|
|
BState
|
|
classDef exampleStyleClass fill:#fff,color: blue;
|
|
class AState,BState exampleStyleClass
|
|
style AState fill:#636,border:1px solid red,color:white;
|
|
</pre>
|
|
<pre id="diagram" class="mermaid2">
|
|
stateDiagram-v2
|
|
|
|
classDef exampleStyleClass background:#bbb,border:1px solid red;
|
|
a --> b
|
|
class a exampleStyleClass
|
|
%% a:::exampleStyleClass
|
|
</pre>
|
|
<pre id="diagram" class="mermaid2">
|
|
stateDiagram
|
|
direction TB
|
|
|
|
accTitle: This is the accessible title
|
|
accDescr: This is an accessible description
|
|
|
|
classDef notMoving fill:white
|
|
classDef movement font-style:italic;
|
|
classDef badBadEvent fill:#f00,color:white,font-weight:bold,stroke-width:2px,stroke:yellow
|
|
|
|
[*] --> Still:::notMoving
|
|
Still --> [*]
|
|
Still --> Moving:::movement
|
|
Moving --> Still
|
|
Moving --> Crash:::movement
|
|
Crash:::badBadEvent --> [*]
|
|
</pre>
|
|
<pre id="diagram" class="mermaid2">
|
|
stateDiagram-v2
|
|
MyState
|
|
note left of MyState : I am a leftie
|
|
note right of MyState : I am a rightie
|
|
|
|
</pre>
|
|
<pre id="diagram" class="mermaid2">
|
|
stateDiagram
|
|
%% direction LR
|
|
|
|
state C0 {
|
|
A0 --> B0
|
|
}
|
|
|
|
C0 --> Apa0
|
|
|
|
</pre>
|
|
<pre id="diagram" class="mermaid2">
|
|
stateDiagram
|
|
direction LR
|
|
|
|
|
|
state C1 {
|
|
A1 --> B1
|
|
}
|
|
|
|
C1 --> Apa1
|
|
|
|
</pre>
|
|
</div>
|
|
<h4>Case 2</h4>
|
|
<div class="flex">
|
|
<pre id="diagram" class="mermaid2">
|
|
stateDiagram
|
|
direction LR
|
|
state Gorilla0 {
|
|
state Apa0 {
|
|
A0 --> B0
|
|
}
|
|
|
|
}
|
|
Apa --> Gorilla0:Label
|
|
A0 --> C0
|
|
%% C1: "`This is C`"
|
|
</pre>
|
|
<pre id="diagram" class="mermaid2">
|
|
stateDiagram
|
|
direction LR
|
|
state Apa1 {
|
|
A1
|
|
}
|
|
|
|
Apa11 --> Apa1
|
|
A1 --> C1
|
|
%% C1: "`This is C`"
|
|
</pre>
|
|
<pre id="diagram" class="mermaid2">
|
|
stateDiagram
|
|
[*] --> Level1
|
|
|
|
state Level1 {
|
|
[*] --> Level2
|
|
|
|
state Level2 {
|
|
[*] --> level2
|
|
level2 --> Level3
|
|
|
|
state Level3 {
|
|
[*] --> level3
|
|
level3 --> [*]
|
|
}
|
|
}
|
|
}
|
|
</pre>
|
|
</div>
|
|
<pre id="diagram" class="mermaid2">
|
|
flowchart LR
|
|
subgraph Apa["Apa"]
|
|
B["This is B"]
|
|
A["Start"]
|
|
end
|
|
A --> B & C["C"]
|
|
Apa --> C
|
|
</pre
|
|
>
|
|
<pre id="diagram" class="mermaid2">
|
|
flowchart RL
|
|
subgraph Apa["Apa"]
|
|
subgraph Gorilla
|
|
A["Start"]
|
|
B["This is B"]
|
|
end
|
|
end
|
|
A --> B & C["C"]
|
|
Gorilla --> C
|
|
</pre
|
|
>
|
|
<pre id="diagram" class="mermaid2">
|
|
flowchart LR
|
|
subgraph Apa["Apa"]
|
|
subgraph Gorilla
|
|
A["Start"]
|
|
B["This is B"]
|
|
end
|
|
end
|
|
A --> B & C["C"]
|
|
Apa --> C
|
|
</pre
|
|
>
|
|
<pre id="diagram" class="mermaid2">
|
|
flowchart LR
|
|
subgraph Apa["Apa"]
|
|
subgraph Gorilla
|
|
B["This is B"]
|
|
A["Start"]
|
|
end
|
|
end
|
|
Apa --> C
|
|
A --> B & C["C"]
|
|
</pre
|
|
>
|
|
|
|
<pre id="diagram" class="mermaid2">
|
|
flowchart LR
|
|
subgraph Gorilla
|
|
subgraph Apa
|
|
A[A] --- B
|
|
end
|
|
end
|
|
Apa --- C
|
|
A --x C
|
|
</pre>
|
|
|
|
<pre id="diagram" class="mermaid2">
|
|
---
|
|
config:
|
|
look: neo
|
|
theme: neo
|
|
layout: elk
|
|
elk.mergeEdges: true
|
|
themeVariables: {}
|
|
---
|
|
%% 'elk.stress',
|
|
%% 'elk.force'
|
|
%%'elk.mrtree'
|
|
%% 'elk.sporeOverlap
|
|
stateDiagram
|
|
direction TB
|
|
A --> B
|
|
A --> C
|
|
A --> D
|
|
A --> E
|
|
A --> F
|
|
state F {
|
|
Another
|
|
}
|
|
Another --> A
|
|
|
|
|
|
</pre
|
|
>
|
|
<pre id="diagram" class="mermaid2">
|
|
flowchart LR
|
|
Apa --Hello--> C
|
|
|
|
</pre
|
|
>
|
|
<pre id="diagram" class="mermaid2">
|
|
%%{init: {"layout": "dagre", "mergeEdges": false} }%%
|
|
flowchart LR
|
|
A ==> B(This is B)
|
|
A[Start] --> B(Is it?)
|
|
B -- Yes --> C[OK]
|
|
C --> D[Rethink]
|
|
D --> B
|
|
B -. No ...-> E[End]
|
|
|
|
|
|
</pre
|
|
>
|
|
<pre id="diagram" class="mermaid2">
|
|
%%{init: {"layout": "elk", "mergeEdges": true} }%%
|
|
flowchart
|
|
A --> B(This is B)
|
|
</pre
|
|
>
|
|
<pre id="diagram" class="mermaid2">
|
|
%%{init: {"layout": "elk", "mergeEdges": false, "elk.nodePlacement.strategy": "SIMPLE"} }%%
|
|
stateDiagram
|
|
state if_state <<choice>>
|
|
[*] --> IsPositive
|
|
IsPositive --> if_state
|
|
if_state --> False: if n < 0
|
|
if_state --> True : if n >= 0
|
|
</pre
|
|
>
|
|
<pre id="diagram" class="mermaid2">
|
|
%%{init: {"layout": "elk", "mergeEdges": false, "elk.nodePlacement.strategy": "SIMPLE"} }%%
|
|
stateDiagram
|
|
state if_state <<choice>>
|
|
[*] --> IsPositive
|
|
IsPositive --> if_state
|
|
if_state --> False: if n < 0
|
|
if_state --> True : if n >= 0
|
|
</pre
|
|
>
|
|
<pre id="diagram" class="mermaid2">
|
|
%%{init: {"layout": "dagre", "mergeEdges": true} }%%
|
|
stateDiagram
|
|
direction TB
|
|
State T1 {
|
|
T12--> T11
|
|
}
|
|
T1 --> T2
|
|
T11 --> T2
|
|
</pre
|
|
>
|
|
<pre id="diagram" class="mermaid2">
|
|
%%{init: {"layout": "dagre", "mergeEdges": true} }%%
|
|
stateDiagram
|
|
State T1 {
|
|
T21
|
|
--
|
|
T22
|
|
}
|
|
</pre
|
|
>
|
|
<pre id="diagram" class="mermaid2">
|
|
%%{init: {"layouts": "elk2", "mergeEdges": true} }%%
|
|
stateDiagram
|
|
State S1 {
|
|
direction TB
|
|
S11
|
|
}
|
|
S1 --> S2
|
|
</pre
|
|
>
|
|
<pre id="diagram" class="mermaid2">
|
|
%%{init: {"layout": "elk", "mergeEdges": true} }%%
|
|
stateDiagram
|
|
State T1 {
|
|
T21
|
|
--
|
|
T22
|
|
}
|
|
</pre
|
|
>
|
|
<pre id="diagram" class="mermaid2">
|
|
%%{init: {"layout": "elk", "mergeEdges": true} }%%
|
|
stateDiagram
|
|
[*] --> T1
|
|
T1 --> T2
|
|
T1 --> T3
|
|
T1 --> T4
|
|
</pre
|
|
>
|
|
<pre id="diagram" class="mermaid2">
|
|
%%{init: {"layout": "elk"} }%%
|
|
stateDiagram
|
|
[*] --> T1
|
|
T1 --> T2
|
|
T2 --> T3
|
|
T3 --> T1
|
|
T1 --> T3
|
|
</pre
|
|
>
|
|
<pre id="diagram" class="mermaid2">
|
|
stateDiagram
|
|
State1: The state with a note
|
|
note right of State1
|
|
Important information! You can write
|
|
notes.
|
|
end note
|
|
</pre
|
|
>
|
|
<pre id="diagram" class="mermaid2">
|
|
stateDiagram-v2
|
|
direction LR
|
|
[*] --> Active
|
|
|
|
state Active {
|
|
direction BT
|
|
[*] --> Inner
|
|
Inner --> NumLockOn : EvNumLockPressed
|
|
}
|
|
%% Outer --> Inner
|
|
</pre
|
|
>
|
|
|
|
<script type="module">
|
|
import mermaid from './mermaid.esm.mjs';
|
|
// import { layouts } from './mermaid-layout-elk.esm.mjs';
|
|
// mermaid.registerLayoutLoaders(layouts);
|
|
mermaid.parseError = function (err, hash) {
|
|
console.error('Mermaid error: ', err);
|
|
};
|
|
mermaid.initialize({
|
|
// theme: 'base',
|
|
// handdrawnSeed: 12,
|
|
look: 'handdrawn',
|
|
// 'elk.nodePlacement.strategy': 'NETWORK_SIMPLEX',
|
|
// layout: 'dagre',
|
|
// layout: 'elk',
|
|
// layout: 'fixed',
|
|
// htmlLabels: false,
|
|
flowchart: { titleTopMargin: 10 },
|
|
// fontFamily: 'Caveat',
|
|
// fontFamily: 'Kalam',
|
|
// fontFamily: 'courier',
|
|
sequence: {
|
|
actorFontFamily: 'courier',
|
|
noteFontFamily: 'courier',
|
|
messageFontFamily: 'courier',
|
|
},
|
|
fontSize: 12,
|
|
logLevel: 0,
|
|
});
|
|
function callback() {
|
|
alert('It worked');
|
|
}
|
|
mermaid.parseError = function (err, hash) {
|
|
console.error('In parse error:');
|
|
console.error(err);
|
|
};
|
|
</script>
|
|
</body>
|
|
</html>
|