Get Started

Get Started with mermaid-py

To get started with mermaid-py, follow these steps:

  1. Install mermaid-py by running the following command:
pip install mermaid-py
  1. Import the mermaid-py module in your Python script:
main.py
import mermaid as md
from mermaid.graph import Graph
 
graph: Graph = Graph('first-graph',"""
graph TD;
    mer(Mermaid)
    flow(FlowChart);
    clas(ClassDiagram)
    gra(Graph)
    erDigram(ERDiagram)
    erdiagram-link(Link)
    entity(Entity)
    flow-link(Link)
    node(Node)
    mer --> flow
    mer --> clas
    mer --> gra
    mer --> erDigram
    flow --> node & flow-link
    erDigram --> entity & erdiagram-link
""")
graphe: md.Mermaid = md.Mermaid(graph)
graphe # !! note this only works in the notebook that rendered the html.
 

the result will be like this