| 1 | <html> |
| 2 | <head> |
| 3 | <link href="https://fonts.googleapis.com/css?family=Montserrat&display=swap" rel="stylesheet" /> |
| 4 | <link href="https://unpkg.com/tailwindcss@^1.0/dist/tailwind.min.css" rel="stylesheet" /> |
| 5 | <link |
| 6 | rel="stylesheet" |
| 7 | href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.7.2/css/font-awesome.min.css" |
| 8 | /> |
| 9 | <link |
| 10 | href="https://fonts.googleapis.com/css?family=Noto+Sans+SC&display=swap" |
| 11 | rel="stylesheet" |
| 12 | /> |
| 13 | <style> |
| 14 | body { |
| 15 | /* background: rgb(221, 208, 208); */ |
| 16 | background: #f4f4f4; |
| 17 | background: #222; |
| 18 | font-family: 'Arial'; |
| 19 | height: 100%; |
| 20 | width: 100%; |
| 21 | margin: 0; |
| 22 | padding: 0; |
| 23 | } |
| 24 | h1 { |
| 25 | color: grey; |
| 26 | } |
| 27 | .mermaid2 { |
| 28 | display: none; |
| 29 | } |
| 30 | .height { |
| 31 | min-height: 600px; |
| 32 | height: 600px; |
| 33 | } |
| 34 | .height2 { |
| 35 | min-height: 600px; |
| 36 | height: 1300px; |
| 37 | } |
| 38 | .width { |
| 39 | width: 33%; |
| 40 | border: 1px solid blue; |
| 41 | padding: 10px; |
| 42 | } |
| 43 | </style> |
| 44 | </head> |
| 45 | <body> |
| 46 | <h1>Showcases of diagrams</h1> |
| 47 | <div class="flex flex-wrap"> |
| 48 | <pre class="mermaid width height"> |
| 49 | graph TD |
| 50 | A[Christmas] -->|Get money| B(Go shopping) |
| 51 | B --> C{Let me think} |
| 52 | B --> G[/Another/] |
| 53 | C ==>|One| D[Laptop] |
| 54 | C -->|Two| E[iPhone] |
| 55 | C -->|Three| F[fa:fa-car Car] |
| 56 | subgraph section |
| 57 | C |
| 58 | D |
| 59 | E |
| 60 | F |
| 61 | G |
| 62 | end |
| 63 | </pre> |
| 64 | <pre class="mermaid width height"> |
| 65 | %%{init2: {'securityLevel': 'loose', 'theme':'base'}}%% |
| 66 | flowchart TD |
| 67 | A[Christmas] -->|Get money| B(Go shopping) |
| 68 | B --> C{Let me think} |
| 69 | B --> G[Another] |
| 70 | C ==>|One| D[Laptop] |
| 71 | C x--x|Two| E[iPhone] |
| 72 | C o--o|Three| F[fa:fa-car Car] |
| 73 | subgraph section |
| 74 | C |
| 75 | D |
| 76 | E |
| 77 | F |
| 78 | G |
| 79 | end |
| 80 | </pre> |
| 81 | <pre class="mermaid width height"> |
| 82 | sequenceDiagram |
| 83 | autonumber |
| 84 | par Action 1 |
| 85 | Alice->>John: Hello John, how are you? |
| 86 | and Action 2 |
| 87 | Alice->>Bob: Hello Bob, how are you? |
| 88 | end |
| 89 | Alice->>+John: Hello John, how are you? |
| 90 | Alice->>+John: John, can you hear me? |
| 91 | John-->>-Alice: Hi Alice, I can hear you! |
| 92 | Note right of John: John is perceptive |
| 93 | John-->>-Alice: I feel great! |
| 94 | loop Every minute |
| 95 | John-->Alice: Great! |
| 96 | end |
| 97 | </pre> |
| 98 | <pre class="mermaid width height"> |
| 99 | classDiagram |
| 100 | Animal "1" <|-- Duck |
| 101 | Animal <|-- Fish |
| 102 | Animal <--o Zebra |
| 103 | Animal : +int age |
| 104 | Animal : +String gender |
| 105 | Animal: +isMammal() |
| 106 | Animal: +mate() |
| 107 | class Duck{ |
| 108 | +String beakColor |
| 109 | +swim() |
| 110 | +quack() |
| 111 | } |
| 112 | class Fish{ |
| 113 | -int sizeInFeet |
| 114 | -canEat() |
| 115 | } |
| 116 | class Zebra{ |
| 117 | +bool is_wild |
| 118 | +run() |
| 119 | } |
| 120 | </pre> |
| 121 | <pre class="mermaid width height"> |
| 122 | gantt |
| 123 | dateFormat :YYYY-MM-DD |
| 124 | title Adding GANTT diagram functionality to mermaid |
| 125 | excludes :excludes the named dates/days from being included in a charted task.. |
| 126 | section A section |
| 127 | Completed task :done, des1, 2014-01-06,2014-01-08 |
| 128 | Active task :active, des2, 2014-01-09, 3d |
| 129 | Future task : des3, after des2, 5d |
| 130 | Future task2 : des4, after des3, 5d |
| 131 | |
| 132 | section Critical tasks |
| 133 | Completed task in the critical line :crit, done, 2014-01-06,24h |
| 134 | Implement parser and jison :crit, done, after des1, 2d |
| 135 | Create tests for parser :crit, active, 3d |
| 136 | Future task in critical line :crit, 5d |
| 137 | Create tests for renderer :2d |
| 138 | Add to mermaid :1d |
| 139 | |
| 140 | section Documentation |
| 141 | Describe gantt syntax :active, a1, after des1, 3d |
| 142 | Add gantt diagram to demo page :after a1 , 20h |
| 143 | Add another diagram to demo page :doc1, after a1 , 48h |
| 144 | |
| 145 | section Last section |
| 146 | Describe gantt syntax :after doc1, 3d |
| 147 | Add gantt diagram to demo page :20h |
| 148 | Add another diagram to demo page :48h |
| 149 | </pre> |
| 150 | <pre class="mermaid width height2"> |
| 151 | stateDiagram |
| 152 | [*] --> Active |
| 153 | |
| 154 | state Active { |
| 155 | [*] --> NumLockOff |
| 156 | NumLockOff --> NumLockOn : EvNumLockPressed |
| 157 | NumLockOn --> NumLockOff : EvNumLockPressed |
| 158 | -- |
| 159 | [*] --> CapsLockOff |
| 160 | CapsLockOff --> CapsLockOn : EvCapsLockPressed |
| 161 | CapsLockOn --> CapsLockOff : EvCapsLockPressed |
| 162 | -- |
| 163 | [*] --> ScrollLockOff |
| 164 | ScrollLockOff --> ScrollLockOn : EvCapsLockPressed |
| 165 | ScrollLockOn --> ScrollLockOff : EvCapsLockPressed |
| 166 | } |
| 167 | state SomethingElse { |
| 168 | A --> B |
| 169 | B --> A |
| 170 | } |
| 171 | |
| 172 | Active --> SomethingElse |
| 173 | note right of SomethingElse : This is the note to the right. |
| 174 | |
| 175 | SomethingElse --> [*] |
| 176 | </pre> |
| 177 | <pre class="mermaid width height2"> |
| 178 | stateDiagram-v2 |
| 179 | [*] --> Active |
| 180 | |
| 181 | state Active { |
| 182 | [*] --> NumLockOff |
| 183 | NumLockOff --> NumLockOn : EvNumLockPressed |
| 184 | NumLockOn --> NumLockOff : EvNumLockPressed |
| 185 | -- |
| 186 | [*] --> CapsLockOff |
| 187 | CapsLockOff --> CapsLockOn : EvCapsLockPressed |
| 188 | CapsLockOn --> CapsLockOff : EvCapsLockPressed |
| 189 | -- |
| 190 | [*] --> ScrollLockOff |
| 191 | ScrollLockOff --> ScrollLockOn : EvCapsLockPressed |
| 192 | ScrollLockOn --> ScrollLockOff : EvCapsLockPressed |
| 193 | } |
| 194 | state SomethingElse { |
| 195 | A --> B |
| 196 | B --> A |
| 197 | } |
| 198 | |
| 199 | Active --> SomethingElse2 |
| 200 | note right of SomethingElse2 : This is the note to the right. |
| 201 | |
| 202 | SomethingElse2 --> [*] |
| 203 | </pre> |
| 204 | <pre class="mermaid width height2"> |
| 205 | erDiagram |
| 206 | CUSTOMER }|..|{ DELIVERY-ADDRESS : has |
| 207 | CUSTOMER ||--o{ ORDER : places |
| 208 | CUSTOMER ||--o{ INVOICE : "liable for" |
| 209 | DELIVERY-ADDRESS ||--o{ ORDER : receives |
| 210 | INVOICE ||--|{ ORDER : covers |
| 211 | ORDER ||--|{ ORDER-ITEM : includes |
| 212 | PRODUCT-CATEGORY ||--|{ PRODUCT : contains |
| 213 | PRODUCT ||--o{ ORDER-ITEM : "ordered in" |
| 214 | </pre> |
| 215 | <pre class="mermaid width height"> |
| 216 | journey |
| 217 | title My working day |
| 218 | section Go to work |
| 219 | Make tea: 5: Me |
| 220 | Go upstairs: 3: Me |
| 221 | Do work: 1: Me, Cat |
| 222 | section Go home |
| 223 | Go downstairs: 5: Me |
| 224 | Sit down: 5: Me |
| 225 | </pre> |
| 226 | <pre class="mermaid width height"> |
| 227 | requirementDiagram |
| 228 | |
| 229 | requirement test_req { |
| 230 | id: 1 |
| 231 | text: the test text. |
| 232 | risk: high |
| 233 | verifymethod: test |
| 234 | } |
| 235 | |
| 236 | functionalRequirement test_req2 { |
| 237 | id: 1.1 |
| 238 | text: the second test text. |
| 239 | risk: low |
| 240 | verifymethod: inspection |
| 241 | } |
| 242 | |
| 243 | performanceRequirement test_req3 { |
| 244 | id: 1.2 |
| 245 | text: the third test text. |
| 246 | risk: medium |
| 247 | verifymethod: demonstration |
| 248 | } |
| 249 | |
| 250 | element test_entity { |
| 251 | type: simulation |
| 252 | } |
| 253 | |
| 254 | element test_entity2 { |
| 255 | type: word doc |
| 256 | docRef: reqs/test_entity |
| 257 | } |
| 258 | |
| 259 | |
| 260 | test_entity - satisfies -> test_req2 |
| 261 | test_req - traces -> test_req2 |
| 262 | test_req - contains -> test_req3 |
| 263 | test_req <- copies - test_entity2 |
| 264 | </pre> |
| 265 | <pre class="mermaid" class="width height"> |
| 266 | gitGraph |
| 267 | commit |
| 268 | branch hotfix |
| 269 | checkout hotfix |
| 270 | commit |
| 271 | branch develop |
| 272 | checkout develop |
| 273 | commit id:"An id" tag:"A tag" |
| 274 | branch featureB |
| 275 | checkout featureB |
| 276 | commit type:HIGHLIGHT |
| 277 | checkout main |
| 278 | checkout hotfix |
| 279 | commit type:NORMAL |
| 280 | checkout develop |
| 281 | commit type:REVERSE |
| 282 | checkout featureB |
| 283 | commit |
| 284 | checkout main |
| 285 | merge hotfix |
| 286 | checkout featureB |
| 287 | commit |
| 288 | checkout develop |
| 289 | branch featureA |
| 290 | commit |
| 291 | checkout develop |
| 292 | merge hotfix |
| 293 | checkout featureA |
| 294 | commit |
| 295 | checkout featureB |
| 296 | commit |
| 297 | checkout develop |
| 298 | merge featureA |
| 299 | branch release |
| 300 | checkout release |
| 301 | commit |
| 302 | checkout main |
| 303 | commit |
| 304 | checkout release |
| 305 | merge main |
| 306 | checkout develop |
| 307 | merge release |
| 308 | |
| 309 | </pre> |
| 310 | </div> |
| 311 | <script type="module"> |
| 312 | import mermaid from './mermaid.esm.mjs'; |
| 313 | mermaid.parseError = function (err, hash) { |
| 314 | // console.error('Mermaid error: ', err); |
| 315 | }; |
| 316 | mermaid.initialize({ |
| 317 | theme: 'base', |
| 318 | themeVariables: { |
| 319 | primaryColor: '#9400D3', |
| 320 | darkMode: true, |
| 321 | background: '#222', |
| 322 | textColor: 'white', |
| 323 | primaryTextColor: '#f4f4f4', |
| 324 | nodeBkg: '#ff0000', |
| 325 | mainBkg: '#0000ff', |
| 326 | tertiaryColor: '#ffffcc', |
| 327 | }, |
| 328 | // arrowMarkerAbsolute: true, |
| 329 | // themeCSS: '.edgePath .path {stroke: red;} .arrowheadPath {fill: red;}', |
| 330 | logLevel: 0, |
| 331 | flowchart: { curve: 'cardinal', htmlLabels: false }, |
| 332 | // gantt: { axisFormat: '%m/%d/%Y' }, |
| 333 | sequence: { actorMargin: 50, showSequenceNumbers: true }, |
| 334 | // sequenceDiagram: { actorMargin: 300 } // deprecated |
| 335 | fontFamily: '"arial", sans-serif', |
| 336 | curve: 'cardinal', |
| 337 | // securityLevel: 'strict' |
| 338 | }); |
| 339 | function callback() { |
| 340 | alert('It worked'); |
| 341 | } |
| 342 | </script> |
| 343 | </body> |
| 344 | </html> |
| 345 | |