From 3209ab6d9d43808aafb64942748e97851d75fde5 Mon Sep 17 00:00:00 2001 From: Dennis Schaller Date: Fri, 9 Aug 2024 11:05:58 +0200 Subject: [PATCH 1/7] add markdown support to sequence diagram notes --- demos/sequence.html | 49 +++++++ package.json | 3 + .../mermaid/src/diagrams/common/common.ts | 91 ++++++++++++ .../sequence/parser/sequenceDiagram.jison | 25 +++- .../src/diagrams/sequence/sequenceRenderer.ts | 31 +++- .../mermaid/src/diagrams/sequence/styles.js | 133 ++++++++++++++++++ .../mermaid/src/diagrams/sequence/svgDraw.js | 52 ++++++- pnpm-lock.yaml | 33 ++++- 8 files changed, 406 insertions(+), 11 deletions(-) diff --git a/demos/sequence.html b/demos/sequence.html index eca935ff5b..4098f5fce0 100644 --- a/demos/sequence.html +++ b/demos/sequence.html @@ -249,6 +249,55 @@

Sequence diagram demos

Alice<<->>Bob: Wow, we said that at the same time! Bob<<-->>Alice: Bidirectional Arrows are so cool + +
+ +
+    sequenceDiagram
+      actor Alice
+      actor John
+      Alice-xJohn: Hello John, how are you?
+      note over Alice,John: [ This is some `markdown` text
+      ```json
+      {
+        "title": "This is a note",
+        "description": "This is a note with a description"
+      }
+      ```
+      ]
+      John--xAlice: Great!
+      note left of Alice: [ This is some `markdown` text
+      ```json
+      {
+        "title": "This is a note",
+        from: "Alice",
+        to: "John",
+        "subtitle": "A very pretty one note",
+        "description": "This is a note with a description"
+      }
+      ```
+      ]
+      Alice--xJohn: Awesome!
+      note right of John: [ This is some `markdown` text
+      ```json
+      {
+        "title": "This is a note",
+        "subtitle": "A very pretty one",
+        "description": "This is a note with a description"
+      }
+      ```
+      There can even be `more markdown`:
+      ```
+        const note = "pretty";
+        if (note === "pretty") {
+          console.log("This is a note with a description");
+        } else {
+          // do something else
+        }
+      ```
+      ]
+    
+