- 
                Notifications
    
You must be signed in to change notification settings  - Fork 32
 
          Add support for mermaid.js diagrams.
          #1338
        
          New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
          
     Closed
      
      
    
  
     Closed
                    Changes from 15 commits
      Commits
    
    
            Show all changes
          
          
            16 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      2088fc6
              
                stage
              
              
                Mpdreamz 462852b
              
                stage
              
              
                Mpdreamz 2a59f07
              
                add mermaid bundle files :/
              
              
                Mpdreamz f60bdb8
              
                Merge remote-tracking branch 'origin/main' into feature/mermaid-support
              
              
                Mpdreamz a6ea1ab
              
                Add dependencies for mermaid and related libraries
              
              
                Mpdreamz acae71d
              
                restore
              
              
                Mpdreamz 2fd4675
              
                ensure we reapply mermaid on htmx navigation too
              
              
                Mpdreamz 315664f
              
                move mermaid to ignored parcel resolver
              
              
                Mpdreamz 0aca585
              
                move to tiny mermaid instead (goes from 3mb to 1.7mb :/)
              
              
                Mpdreamz 00957d5
              
                Add an action that validates if `assembler.yml` content-source mappin…
              
              
                Mpdreamz 7b82d25
              
                manually include mermaid.tiny.js and only if mermaid is used on the p…
              
              
                Mpdreamz 8f689ea
              
                fix unit tests
              
              
                Mpdreamz 8fa640e
              
                update prettier ignores and remove unneeded parcel plugin
              
              
                Mpdreamz 1c8e68d
              
                run linter
              
              
                Mpdreamz 6be1f37
              
                update eslint config
              
              
                Mpdreamz bda06fe
              
                Edit docs
              
              
                theletterf File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,164 @@ | ||
| # Diagrams | ||
| 
     | 
||
| You can embedd diagrams using [mermaid.js](https://mermaid.js.org) | ||
| 
     | 
||
| ## Flowcharts | ||
| 
     | 
||
| :::::{tab-set} | ||
| 
     | 
||
| ::::{tab-item} Output | ||
| 
     | 
||
| ```mermaid | ||
| flowchart LR | ||
| A[Jupyter Notebook] --> C | ||
| B[MyST Markdown] --> C | ||
| C(mystmd) --> D{AST} | ||
| D <--> E[LaTeX] | ||
| E --> F[PDF] | ||
| D --> G[Word] | ||
| D --> H[React] | ||
| D --> I[HTML] | ||
| D <--> J[JATS] | ||
| ``` | ||
| 
     | 
||
| :::: | ||
| 
     | 
||
| ::::{tab-item} Markdown | ||
| ````markdown | ||
| ```mermaid | ||
| flowchart LR | ||
| A[Jupyter Notebook] --> C | ||
| B[MyST Markdown] --> C | ||
| C(mystmd) --> D{AST} | ||
| D <--> E[LaTeX] | ||
| E --> F[PDF] | ||
| D --> G[Word] | ||
| D --> H[React] | ||
| D --> I[HTML] | ||
| D <--> J[JATS] | ||
| ``` | ||
| ```` | ||
| :::: | ||
| 
     | 
||
| ::::: | ||
| 
     | 
||
| 
     | 
||
| ## Sequence Diagram | ||
| 
     | 
||
| 
     | 
||
| ```mermaid | ||
| sequenceDiagram | ||
| participant Alice | ||
| participant Bob | ||
| Alice->>John: Hello John, how are you? | ||
| loop HealthCheck | ||
| John->>John: Fight against hypochondria | ||
| end | ||
| Note right of John: Rational thoughts <br/>prevail! | ||
| John-->>Alice: Great! | ||
| John->>Bob: How about you? | ||
| Bob-->>John: Jolly good! | ||
| ``` | ||
| 
     | 
||
| ## Gant charts | ||
| 
     | 
||
| ```mermaid | ||
| gantt | ||
| dateFormat YYYY-MM-DD | ||
| title Adding GANTT diagram to mermaid | ||
| excludes weekdays 2014-01-10 | ||
| 
     | 
||
| section A section | ||
| Completed task :done, des1, 2014-01-06,2014-01-08 | ||
| Active task :active, des2, 2014-01-09, 3d | ||
| Future task : des3, after des2, 5d | ||
| Future task2 : des4, after des3, 5d | ||
| ``` | ||
| 
     | 
||
| ## Class Diagram | ||
| 
     | 
||
| ```mermaid | ||
| classDiagram | ||
| Class01 <|-- AveryLongClass : Cool | ||
| Class03 *-- Class04 | ||
| Class05 o-- Class06 | ||
| Class07 .. Class08 | ||
| Class09 --> C2 : Where am i? | ||
| Class09 --* C3 | ||
| Class09 --|> Class07 | ||
| Class07 : equals() | ||
| Class07 : Object[] elementData | ||
| Class01 : size() | ||
| Class01 : int chimp | ||
| Class01 : int gorilla | ||
| Class08 <--> C2: Cool label | ||
| ``` | ||
| 
     | 
||
| ## Git Graph | ||
| 
     | 
||
| ```mermaid | ||
| gitGraph | ||
| commit | ||
| commit | ||
| branch develop | ||
| commit | ||
| commit | ||
| commit | ||
| checkout main | ||
| commit | ||
| commit | ||
| ``` | ||
| 
     | 
||
| 
     | 
||
| ## Entity Relation Diagram | ||
| 
     | 
||
| ```mermaid | ||
| erDiagram | ||
| CUSTOMER ||--o{ ORDER : places | ||
| ORDER ||--|{ LINE-ITEM : contains | ||
| CUSTOMER }|..|{ DELIVERY-ADDRESS : uses | ||
| ``` | ||
| 
     | 
||
| ## User Journey | ||
| 
     | 
||
| ```mermaid | ||
| journey | ||
| title My working day | ||
| section Go to work | ||
| Make tea: 5: Me | ||
| Go upstairs: 3: Me | ||
| Do work: 1: Me, Cat | ||
| section Go home | ||
| Go downstairs: 5: Me | ||
| Sit down: 5: Me | ||
| ``` | ||
| 
     | 
||
| ## Quadrant Chart | ||
| 
     | 
||
| ```mermaid | ||
| quadrantChart | ||
| title Reach and engagement of campaigns | ||
| x-axis Low Reach --> High Reach | ||
| y-axis Low Engagement --> High Engagement | ||
| quadrant-1 We should expand | ||
| quadrant-2 Need to promote | ||
| quadrant-3 Re-evaluate | ||
| quadrant-4 May be improved | ||
| Campaign A: [0.3, 0.6] | ||
| Campaign B: [0.45, 0.23] | ||
| Campaign C: [0.57, 0.69] | ||
| Campaign D: [0.78, 0.34] | ||
| Campaign E: [0.40, 0.34] | ||
| Campaign F: [0.35, 0.78] | ||
| ``` | ||
| 
     | 
||
| ## XY Chart | ||
| 
     | 
||
| ```mermaid | ||
| xychart-beta | ||
| title "Sales Revenue" | ||
| x-axis [jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec] | ||
| y-axis "Revenue (in $)" 4000 --> 11000 | ||
| bar [5000, 6000, 7500, 8200, 9500, 10500, 11000, 10200, 9200, 8500, 7000, 6000] | ||
| line [5000, 6000, 7500, 8200, 9500, 10500, 11000, 10200, 9200, 8500, 7000, 6000] | ||
| ``` | ||
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -1,3 +1,5 @@ | ||
| # Ignore artifacts: | ||
| build | ||
| coverage | ||
| mermaid.js | ||
| mermaid.tiny.js | 
                              
      
                  reakaleek marked this conversation as resolved.
               
          
            Show resolved
            Hide resolved
         | 
            
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,91 @@ | ||
| .mermaid { | ||
| @apply border-grey-10 mt-4 rounded-md border-2 font-sans; | ||
| 
     | 
||
| font-size: 0.875em !important; | ||
| 
     | 
||
| .nodeLabel { | ||
| @apply font-mono; | ||
| font-size: 0.875em !important; | ||
| } | ||
| .labelText { | ||
| @apply font-mono; | ||
| font-size: 0.875em !important; | ||
| } | ||
| .loopText { | ||
| @apply font-mono; | ||
| font-size: 0.875em !important; | ||
| } | ||
| .noteText { | ||
| @apply font-mono; | ||
| font-size: 0.875em !important; | ||
| } | ||
| .messageText { | ||
| @apply font-mono; | ||
| font-size: 0.875em !important; | ||
| } | ||
| text.actor { | ||
| @apply font-mono; | ||
| font-size: 0.875em !important; | ||
| } | ||
| .actor { | ||
| stroke: var(--color-blue-elastic-50); | ||
| fill: var(--color-blue-elastic-10); | ||
| } | ||
| text.actor { | ||
| fill: var(--color-ink-dark); | ||
| stroke: none; | ||
| @apply font-mono; | ||
| font-size: 0.875em !important; | ||
| } | ||
| 
     | 
||
| .actor-line { | ||
| stroke: var(--color-grey-70); | ||
| } | ||
| 
     | 
||
| .messageLine0 { | ||
| stroke-width: 1.5; | ||
| stroke: black; | ||
| } | ||
| 
     | 
||
| .messageLine1 { | ||
| stroke-width: 1.5; | ||
| stroke: var(--color-ink-dark); | ||
| } | ||
| 
     | 
||
| #arrowhead { | ||
| fill: var(--color-ink-dark); | ||
| } | ||
| 
     | 
||
| .messageText { | ||
| fill: var(--color-ink-dark); | ||
| stroke: none; | ||
| @apply font-mono; | ||
| font-size: 1em; | ||
| } | ||
| 
     | 
||
| .labelBox { | ||
| stroke: #ccccff; | ||
| fill: #ececff; | ||
| } | ||
| 
     | 
||
| .labelText { | ||
| fill: var(--color-ink-dark); | ||
| stroke: none; | ||
| @apply font-mono; | ||
| } | ||
| 
     | 
||
| .loopText { | ||
| fill: var(--color-ink-dark); | ||
| stroke: none; | ||
| font-size: 1em; | ||
| } | ||
| .note { | ||
| fill: var(--color-yellow-10) !important; | ||
| stroke: var(--color-yellow-50) !important; | ||
| font-size: 1em !important; | ||
| } | ||
| 
     | 
||
| rect.background { | ||
| display: none; | ||
| } | ||
| } | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| var mermaidInitialize = function () { | ||
| mermaid.initialize({ | ||
| startOnLoad: false, theme: 'base', | ||
| themeVariables: { | ||
| fontFamily: 'inherit', | ||
| altFontFamily: 'inherit', | ||
| fontSize: '0.875em', | ||
| }, | ||
| fontFamily: 'inherit', altFontFamily: 'inherit', | ||
| "sequence": { | ||
| "actorFontFamily": "inherit", | ||
| "noteFontFamily": "inherit", | ||
| "messageFontFamily": "inherit" | ||
| }, | ||
| "journey": { | ||
| "taskFontFamily": "inherit" | ||
| } | ||
| }); | ||
| mermaid.run({ | ||
| nodes: document.querySelectorAll('.mermaid'), | ||
| }); | ||
| } | ||
| 
     | 
||
| document.addEventListener('htmx:load', function () { | ||
| mermaidInitialize() | ||
| }) | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
      
      Oops, something went wrong.
        
    
  
      
      Oops, something went wrong.
        
    
  
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we also add here which diagrams are not supported? (and maybe why)
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Edited the docs right now