Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Get an image corresponding to a Mermaid-js specification via the web Mermaid-ink interface of Mermaid-js
ResourceFunction["MermaidInk"][s] retrieves an image defined by the spec s from Mermaid's Ink Web interface. |
TB | top to bottom |
TD | top-down |
BT | bottom to top |
RL | right to left |
LR | left to right |
Generate a flowchart from a Mermaid specification:
In[1]:= | ![]() |
Out[1]= | ![]() |
Create a Graphics expression from a class diagram:
In[2]:= | ![]() |
Out[2]= | ![]() |
The first argument can be a Graph object -- the corresponding Mermaid-js graph is produced. Here is a random graph that has both directed and undirected edges (some edges have tags):
In[3]:= | ![]() |
Out[6]= | ![]() |
Here is the corresponding mermaid-js image:
In[7]:= | ![]() |
Out[7]= | ![]() |
Here is a left-to-right version:
In[8]:= | ![]() |
Out[8]= | ![]() |
Create a Sequence Diagram:
In[9]:= | ![]() |
Out[9]= | ![]() |
State diagram:
In[10]:= | ![]() |
Out[10]= | ![]() |
Entity Relationship Diagram:
In[11]:= | ![]() |
Out[11]= | ![]() |
User Journey -- PNG image is obtained and cropped:
In[12]:= | ![]() |
Out[12]= | ![]() |
Gantt chart:
In[13]:= | ![]() |
Out[13]= | ![]() |
Pie chart:
In[14]:= | ![]() |
Out[14]= | ![]() |
Requirement Diagram:
In[15]:= | ![]() |
Out[15]= | ![]() |
The option "MermaidDirectives" is used when the first argument is a Graph object:
In[16]:= | ![]() |
Out[17]= | ![]() |
Create a Markdown-related conversions flowchart:
In[18]:= | ![]() |
Out[18]= | ![]() |
Create a Sequence Diagram for a blogging app service communication:
In[19]:= | ![]() |
Out[19]= | ![]() |
There is a fairly straightforward correspondence between the edge specifications for Graph and Mermaid graph (or flowchart) specifications:
In[20]:= | ![]() |
Out[20]= | ![]() |
In[21]:= | ![]() |
Out[21]= | ![]() |
In[22]:= | ![]() |
Out[22]= | ![]() |
A diagram that clarifies the execution of MermaidInk:
In[23]:= | ![]() |
Out[23]= | ![]() |
For some textual content MermaidInk specifications should use quotes. Also, a new line character in text can be included using “<br/>”:
In[24]:= | ![]() |
Out[24]= | ![]() |
Without the quotes for block "A" the specifications above does not work:
In[25]:= | ![]() |
Out[25]= | ![]() |
Larger flowchart with some styling:
In[26]:= | ![]() |
Out[26]= | ![]() |
Some interesting interaction:
In[27]:= | ![]() |
Out[27]= | ![]() |
This work is licensed under a Creative Commons Attribution 4.0 International License