Mermaid Graph Example

Table of Contents

Purpose

Example of using mermaid js to draw a subway network graph.

%%{init: { 'gitGraph': {'mainBranchName': 'Blue Line'} } }%%
    gitGraph
       commit id: "University of Montreal"
       commit id: "McGill"
       branch "Yellow Line"
       checkout "Yellow Line"
       commit id: "Olympic Stadium"
       checkout "Blue Line"
       commit id: "Verdun"
       checkout "Yellow Line"
       branch "Green Line"
       checkout "Green Line"
       commit id: "Salle de Bain"
       checkout "Blue Line"
       commit id: "Chambre"
       checkout "Yellow Line"
       commit id: "Minion"
       checkout  "Blue Line"
       merge "Yellow Line" id: "China Town" tag: "Transfer to Blue Line" type: REVERSE
       checkout "Green Line"
       commit id: "Petite Prince"
       checkout "Blue Line"
       commit id: "Arrondissement"

Source Code as below:

%%{init: { 'gitGraph': {'mainBranchName': 'Blue Line'} } }%%
    gitGraph
       commit id: "University of Montreal"
       commit id: "McGill"
       branch "Yellow Line"
       checkout "Yellow Line"
       commit id: "Olympic Stadium"
       checkout "Blue Line"
       commit id: "Verdun"
       checkout "Yellow Line"
       branch "Green Line"
       checkout "Green Line"
       commit id: "Salle de Bain"
       checkout "Blue Line"
       commit id: "Chambre"
       checkout "Yellow Line"
       commit id: "Minion"
       checkout  "Blue Line"
       merge "Yellow Line" id: "China Town" tag: "Transfer to Blue Line" type: REVERSE
       checkout "Green Line"
       commit id: "Petite Prince"
       checkout "Blue Line"
       commit id: "Arrondissement"

Reference

Leave a Comment

Your email address will not be published. Required fields are marked *


The reCAPTCHA verification period has expired. Please reload the page.

Scroll to Top