Skip to content

Instantly share code, notes, and snippets.

@andreia
Created March 12, 2022 23:24
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save andreia/ef2fd292c6fdadb6a927b975c300e532 to your computer and use it in GitHub Desktop.
Save andreia/ef2fd292c6fdadb6a927b975c300e532 to your computer and use it in GitHub Desktop.
Mermaid diagrams on Github markdown

Flowchart

flowchart LR
    A[If I] --> B{could};
    B -- Yes --> C[I would];
    C --> D[Let it go, Surrender, Dislocate];

Pie chart

pie 
  title Pet ownership
  "Dogs" : 386
  "Cats" : 97
  "Fish" : 15

Class diagram

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()
      }

Refs: https://mermaid-js.github.io/mermaid/#/classDiagram https://github.blog/2022-02-14-include-diagrams-markdown-files-mermaid/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment