All posts
July 17, 2026 11 min read

Mermaid Flowchart Tutorial: Embed Diagrams in GitHub, Notion, and Docs

Learn Mermaid flowchart syntax with copy-paste examples for GitHub README files, GitLab, Notion, and Obsidian — plus how to export Mermaid from FreeFlowCharts.

mermaid github notion tutorial flowchart markdown docs

Mermaid lets you describe diagrams in plain text inside Markdown. When GitHub, GitLab, Notion, or Obsidian render the page, the text becomes a flowchart. That means diagrams live next to your code, review cleanly in pull requests, and update without re-exporting PNG files.

This tutorial covers core flowchart syntax, real examples, embedding tips, and how FreeFlowCharts can export Mermaid when you prefer a visual editor first.

Why Mermaid for engineering docs

  • Version control friendly: — diffs show text changes, not binary image noise.
  • No design tool required: for simple flows.
  • Portable: across README files, ADRs, runbooks, and wikis.
  • Reviewable: — teammates comment on the same PR as the process change.
  • Minimal flowchart

    In a Markdown file (GitHub README example):

    flowchart TD

    A[Start] --> B{Valid input?}

    B -->|Yes| C[Create account]

    B -->|No| D[Show errors]

    C --> E[Send verify email]

    D --> B

    E --> F[End]

    Notes:

  • flowchart TD means top-down. Use LR for left-to-right.
  • [] is a process rectangle; {} is a decision diamond; () is a stadium/rounded shape often used for start/end.
  • Arrow labels use -->|label|.
  • Node shapes you will use most

    SyntaxMeaning
    `id[Text]`Process (rectangle)
    `id{Text}`Decision (diamond)
    `id([Text])`Stadium / terminator-style
    `id[(Text)]`Cylindrical database shape
    `id((Text))`Circle

    Subgraphs for swimlanes-ish grouping

    flowchart LR
      subgraph Client
        A[Submit form]
      end
      subgraph API
        B{Auth OK?}
        C[Write DB]
      end
      A --> B
      B -->|Yes| C
      B -->|No| D[401 response]

    Subgraphs are not full swimlanes, but they clarify system boundaries in architecture docs.

    CI/CD example

    flowchart TD
      push[Git push] --> build[Build]
      build --> test[Unit tests]
      test --> ok{Tests pass?}
      ok -->|No| fail[Fail pipeline]
      ok -->|Yes| review[Code review]
      review --> merge{Approved?}
      merge -->|No| fix[Request changes]
      fix --> push
      merge -->|Yes| deploy[Deploy staging]
      deploy --> smoke[Smoke tests]
      smoke --> prod{Promote?}
      prod -->|Yes| live[Production]
      prod -->|No| hold[Hold release]

    Support escalation example

    flowchart TD
      t[Ticket created] --> l1[L1 triage]
      l1 --> known{Known issue?}
      known -->|Yes| kb[Send KB article]
      known -->|No| sev{Severity}
      sev -->|P1| l2[Page L2]
      sev -->|P2/P3| queue[L1 queue]
      queue --> resolve{Resolved?}
      l2 --> resolve
      resolve -->|No| l3[Escalate L3]
      resolve -->|Yes| close[Close ticket]
      kb --> close
      l3 --> close

    Embedding in GitHub

  • Create or edit a .md file.
  • Insert a fenced code block with language mermaid.
  • Commit. GitHub renders Mermaid in README, issues, and PR descriptions (supported Mermaid version depends on GitHub’s renderer).
  • Tip: Keep diagrams under ~30 nodes in README files. Link to a longer FreeFlowCharts share URL for full interactive views.

    Embedding in Notion

    Notion supports Mermaid in code blocks on many plans/workspaces (availability can vary). Create a code block, set language to Mermaid, paste the source, and toggle preview if available. For guaranteed visual fidelity, export PNG from FreeFlowCharts and attach the image, while keeping Mermaid in Git as the source of truth.

    Obsidian and other Markdown tools

    Obsidian’s Mermaid support is excellent for personal knowledge bases. Paste the same fenced blocks. For static site generators, use a Mermaid plugin or pre-render SVG in CI.

    Visual editor → Mermaid with FreeFlowCharts

    If you think better on a canvas:

  • Build the flow in the FreeFlowCharts editor.
  • Export Mermaid syntax.
  • Paste into your README or wiki.
  • When the process changes, either edit Mermaid text or update the visual diagram and re-export.
  • This hybrid workflow is popular with PMs who draft visually and engineers who want text in Git.

    Common Mermaid pitfalls

  • Unquoted special characters: in labels can break parsing — simplify text.
  • Huge diagrams: slow page render — split into linked docs.
  • Assuming every host supports Mermaid: — always check (some older wikis need plugins).
  • Styling fights: — keep default theme in docs; brand colors can go in exported PNG for slides.
  • When not to use Mermaid

  • Pixel-perfect executive decks (export PNG/SVG from FreeFlowCharts instead).
  • Heavily branded posters.
  • Diagrams that non-technical stakeholders must edit without learning syntax.
  • Next steps

  • Practice with the CI/CD and support examples above.
  • Read Export Flowcharts as Mermaid for FreeFlowCharts-specific export notes.
  • Browse API docs if an agent should generate diagrams into your pipeline.