antononcube / WL-MermaidJS-paclet

Wolfram Language (aka Mathematica) paclet for obtaining Mermaid-JS images and graphics.
https://resources.wolframcloud.com/PacletRepository/resources/AntonAntonov/MermaidJS/
MIT License
3 stars 2 forks source link
mermaid-charting-language mermaid-cli mermaid-diagrams mermaidjs wolfram-language wolfram-mathematica

MermaidJS WL paclet

Wolfram Language (aka Mathematica) paclet for obtaining Mermaid-JS images and graphics.

Here is an example:

MermaidInk["
classDiagram
    Animal <|-- Duck
    Animal <|-- Fish
    Animal <|-- Zebra
    Animal : +int age
    Animal : +String gender
    Animal: +isMammal()
    Animal: +mate()
    class Duck{
        +String beakColor
        +swim()
        +quack()
    }
    class Fish{
        -int sizeInFeet
        -canEat()
    }
    class Zebra{
        +bool is_wild
        +run()
    }
"]


Flowchart

Here is a diagram that clarifies the execution of MermaidInk:

graph TD
UI[/User input/]
MS{{Mermaid-ink server}}
WL{{Wolfram Language}}
WLnb>Notebook]
WLIC[[Input cell]]
WLOC[[Output cell]]
MI[MermaidInk]
UI --> WLIC -.- WLnb
WLIC --> MI -.- WL
MI --> |spec|MS
MS --> |image|MI
MI --> WLOC -.- WLnb
WLnb -.- WL