Home Publications Certifications LinkedIn GitHub Email

Let's say we want to a build flowchart but don't want to spend time drawing it nicely just to have to update and re-draw it later. Can we create charts with just code that takes care of the drawing and formatting for us? With Mermaid, we can! Let's try this out using the flowchart described in https://psychology.fandom.com/wiki/Flowcharts.

flowchart LR

linkStyle default stroke:white,arrowhead:white,color:black
classDef pink fill:#eb3dd6,stroke:#000,stroke-width:2px,color:#fff
classDef yellow fill:#fc822b,stroke:#000,stroke-width:2px,color:#fff
classDef green fill:#16b522,stroke:#000,stroke-width:2px,color:#fff

Start(Lamp Doesn't Work):::pink ---> A{Lamp plugged in?}:::yellow
A{Lamp plugged in?} ---> |Yes|B{Bulb burned out?}:::yellow
A ---> |No| C(Plug in lamp):::green
B ---> |Yes| D(Replace bulb):::green
B ---> |No| E(Buy new lamp):::green

This is the code used to generate the figure above