Skip to content
ChartForgeX

Mermaid diagrams in .NET

ChartForgeX.Mermaid parses Mermaid source and renders it through the native ChartForgeX engine, with no browser, no Node.js and no mermaid-cli.

Families rendered
33
Atlas themes
2
Browsers needed
0
Mermaidsequence.mmd
---
title: Dashboard sign-in
---
sequenceDiagram
  autonumber
  actor User
  participant App
  participant IdP as Identity provider
  participant API
  User->>App: Open dashboard
  App->>IdP: Authorization request
  IdP-->>App: ID token + access token
  App->>API: GET /reports (Bearer token)
  alt token valid
    API-->>App: 200 report data
  else token expired
    API-->>App: 401 Unauthorized
  end
  Note over App,API: Tokens refresh silently before expiry
  App-->>User: Render charts
sequence.svg21 KB, rendered by ChartForgeX
A sequence diagram rendered by ChartForgeX from the Mermaid source beside it: a user, an app, an identity provider and an API exchanging tokens.

Family atlas

Every diagram below is drawn by ChartForgeX from the source shown with it. Syntax support does not mean the same layout or pixels as Mermaid's browser renderer. Each diagram is drawn by ChartForgeX with your theme, and diagnostics tell you when source is kept without an exact visual interpretation.

Flows and structure 13

  • Flowchart diagram rendered by ChartForgeX from its Mermaid source. Flowchart diagram rendered by ChartForgeX from its Mermaid source, dark theme.

    Flowchart

    Steps, decisions and branches in a process.

    Source 10 lines
    Mermaidflowchart.mmd
    ---
    title: Incident response
    ---
    flowchart TD
      alert([Alert raised]) --> triage{Known issue?}
      triage -->|yes| runbook[Run the runbook]
      triage -->|no| owner[Page the<br/>service owner]
      runbook --> verify[Verify recovery]
      owner --> fix[Ship a fix]
      fix --> verify
    Edit in playground
  • Sequence diagram rendered by ChartForgeX from its Mermaid source. Sequence diagram rendered by ChartForgeX from its Mermaid source, dark theme.

    Sequence

    Messages between participants, in the order they happen.

    Source 20 lines
    Mermaidsequence.mmd
    ---
    title: Dashboard sign-in
    ---
    sequenceDiagram
      autonumber
      actor User
      participant App
      participant IdP as Identity provider
      participant API
      User->>App: Open dashboard
      App->>IdP: Authorization request
      IdP-->>App: ID token + access token
      App->>API: GET /reports (Bearer token)
      alt token valid
        API-->>App: 200 report data
      else token expired
        API-->>App: 401 Unauthorized
      end
      Note over App,API: Tokens refresh silently before expiry
      App-->>User: Render charts
    Edit in playground
  • Class diagram rendered by ChartForgeX from its Mermaid source. Class diagram rendered by ChartForgeX from its Mermaid source, dark theme.

    Class

    Types, their members and how they relate.

    Source 18 lines
    Mermaidclass.mmd
    ---
    title: Chart model
    ---
    classDiagram
      class Chart {
        +string Title
        +WithSize(width, height)
        +ToSvg() string
      }
      class ChartSeries {
        +string Name
        +ChartPoint[] Points
      }
      class VisualTheme {
        +VisualTypography Typography
      }
      Chart "1" *-- "many" ChartSeries : contains
      Chart --> VisualTheme : uses
    Edit in playground
  • State diagram rendered by ChartForgeX from its Mermaid source. State diagram rendered by ChartForgeX from its Mermaid source, dark theme.

    State

    Composite states, concurrent regions, notes and safe named or direct paints.

    Source 15 lines
    Mermaidstate.mmd
    ---
    title: Document review
    ---
    stateDiagram-v2
    direction LR
    classDef marked fill:#fef9c3,stroke:#92400e,color:#78350f
    Ready --> Review:::marked: submit
    class Ready marked
    style Review fill:#dbeafe,color:#1e3a8a
    state Processing {
      direction TB
      InnerReady --> InnerDone: finish
    }
    Review --> Processing: accept
    Processing --> Done: complete
    Edit in playground
  • Entity relationship diagram rendered by ChartForgeX from its Mermaid source. Entity relationship diagram rendered by ChartForgeX from its Mermaid source, dark theme.

    Entity relationship

    Entities, their attributes and the cardinality between them.

    Source 17 lines
    Mermaider.mmd
    ---
    title: Orders schema
    ---
    erDiagram
      CUSTOMER ||--o{ ORDER : places
      ORDER ||--|{ LINE_ITEM : contains
      PRODUCT ||--o{ LINE_ITEM : "ordered in"
      CUSTOMER {
        string id PK
        string name
        string email
      }
      ORDER {
        string id PK
        string customerId FK
        date placed
      }
    Edit in playground
  • Requirement diagram rendered by ChartForgeX from its Mermaid source. Requirement diagram rendered by ChartForgeX from its Mermaid source, dark theme.

    Requirement

    Requirements and the elements that satisfy or verify them.

    Source 28 lines
    Mermaidrequirement.mmd
    ---
    title: Sign-in requirements
    ---
    requirementDiagram
    direction LR
    functionalRequirement mfa_req {
      id: "SEC-1"
      text: Every account signs in with a strong method.
      risk: High
      verifymethod: Test
    }
    performanceRequirement report_req {
      id: "OPS-4"
      text: The weekly report renders in under a second.
      risk: Low
      verifymethod: Analysis
    }
    element auth_service {
      type: service
      docref: "Identity provider"
    }
    element report_job {
      type: job
      docref: "ChartForgeX report"
    }
    auth_service - satisfies -> mfa_req
    report_job - verifies -> mfa_req
    report_job - satisfies -> report_req
    Edit in playground
  • Architecture diagram rendered by ChartForgeX from its Mermaid source. Architecture diagram rendered by ChartForgeX from its Mermaid source, dark theme.

    Architecture

    Services, groups and connections on a system map.

    Source 16 lines
    Mermaidarchitecture.mmd
    ---
    title: Report platform
    ---
    architecture-beta
    group edge(cloud)[Edge]
    group core(cloud)[Platform]
    group data(database)[Data] in core
    service web(internet)[Web] in edge
    service api(server)[API] in core
    service renderer(server)[Renderer] in core
    service sql(database)[SQL] in data
    service blob(disk)[Cache] in data
    web:R --> L:api
    api:R --> L:renderer
    renderer:B --> T:blob
    api:B --> T:sql
    Edit in playground
  • C4 diagram rendered by ChartForgeX from its Mermaid source. C4 diagram rendered by ChartForgeX from its Mermaid source, dark theme.

    C4

    People, systems, nested boundaries and ordered relationships.

    Source 13 lines
    Mermaidc4.mmd
    C4Container
    title Checkout platform
    Person(customer, "Customer", "Places an order")
    Enterprise_Boundary(company, "Company") {
      System_Boundary(shop, "Store") {
        Container(web, "Web app", "Browser", "Browse products and complete checkout")
        Container(api, "Order service", ".NET", "Validate orders and coordinate payment")
        ContainerDb(db, "Orders", "SQL", "Store orders and their fulfilment state")
      }
    }
    Rel(customer, web, "Places an order")
    Rel(web, api, "Submits checkout", "HTTPS")
    Rel(api, db, "Stores the order")
    Edit in playground
  • Block diagram rendered by ChartForgeX from its Mermaid source. Block diagram rendered by ChartForgeX from its Mermaid source, dark theme.

    Block

    Blocks placed on a column grid, joined by links.

    Source 12 lines
    Mermaidblock.mmd
    ---
    title: Render pipeline
    ---
    block-beta
    columns 3
    collect["Collect"] model["Typed model"] render["Render"]
    space:2 svg["SVG"]
    space:2 png["PNG"]
    collect --> model
    model --> render
    render --> svg
    render --> png
    Edit in playground
  • Packet diagram rendered by ChartForgeX from its Mermaid source. Packet diagram rendered by ChartForgeX from its Mermaid source, dark theme.

    Packet

    Bit ranges of a protocol header, row by row.

    Source 8 lines
    Mermaidpacket.mmd
    ---
    title: TCP header
    ---
    packet-beta
    0-15: "Source Port"
    16-31: "Destination Port"
    32-63: "Sequence Number"
    +32: "Acknowledgment Number"
    Edit in playground
  • Agentflow diagram rendered by ChartForgeX from its Mermaid source. Agentflow diagram rendered by ChartForgeX from its Mermaid source, dark theme.

    Agentflow

    Nested agent flows with inert connector and metadata facts.

    Source 33 lines
    Mermaidagentflow.mmd
    ---
    title: Review workflow
    ---
    agentflow-beta LR
    connector store["Object store"]
    store@{ endpoint: "https://example.invalid/data", protocol: http }
    global
      shared["Policy guide"]@{ shape: refdoc }
    end
    flow team["Review team"]
      brief["Request"]@{ shape: input }
      flow worker["Worker"]
        read["Read input"]@{
          shape: tool
          connectorRef: store.read
          policy:
            retries: 2
            enabled: true
            tags: [safe, deterministic]
            constructor: ignored
          instruction: "Display data, never execute it."
        }
        gate["Ready?"]@{ shape: decision }
        read edge1@--> gate
        gate -- no --> read
        read -.- shared
      end
      worker@{ view: collapsed }
      publish["Publish"]@{ shape: action }
      brief --> read
      gate --x publish
    end
    edge1@{ instruction: "Only after validation" }
    Edit in playground
  • ZenUML diagram rendered by ChartForgeX from its Mermaid source. ZenUML diagram rendered by ChartForgeX from its Mermaid source, dark theme.

    ZenUML

    Code-like calls and control fragments drawn by the native sequence owner.

    Source 41 lines
    Mermaidzenuml.mmd
    zenuml
    title Checkout occurrences
    group "Application" {
      @Actor User
      @Control Service
    }
    @Database Store
    @Queue Bus
    @Starter(User)
    // Accept the request
    Service.checkout(order) {
      if (valid && !cancelled) {
        String receipt = new Receipt(order) {
          Store.save(order)
          return saved
        }
      } else {
        return declined
      }
      loop (retries < 3) {
        Store.retry(order)
      }
      par {
        Bus: ready(order)
      }
      critical (commitLock) {
        Store.commit()
      }
      opt (notify) {
        Bus: notify(order)
      }
      try {
        Store.flush()
      } catch (StorageError error) {
        Store.recover(error)
      } finally {
        Store.close()
      }
      return accepted
    }
    Service --> User: confirmed
    Edit in playground
  • Railroad diagram rendered by ChartForgeX from its Mermaid source. Railroad diagram rendered by ChartForgeX from its Mermaid source, dark theme.

    Railroad

    Symbolic grammar rules and choices; bounded IR, EBNF, ABNF and PEG frontends.

    Source 5 lines
    Mermaidrailroad.mmd
    railroad-beta
    title "Expression grammar"
    expression = sequence(nonterminal("term"), zeroOrMore(sequence(choice(terminal("+"), terminal("-")), nonterminal("term")))) ;
    term = sequence(optional(terminal("-")), oneOrMore(nonterminal("digit"))) ;
    digit = choice(terminal("0"), terminal("1"), special("another decimal digit")) ;
    Edit in playground

Planning and process 8

  • Gantt diagram rendered by ChartForgeX from its Mermaid source. Gantt diagram rendered by ChartForgeX from its Mermaid source, dark theme.

    Gantt

    Tasks, dependencies and milestones on a calendar.

    Source 11 lines
    Mermaidgantt.mmd
    gantt
      title Release train
      dateFormat YYYY-MM-DD
      section Engine
      Layout pass      :done,    l1, 2026-09-01, 12d
      Label placement  :active,  l2, after l1, 10d
      section Surfaces
      PNG parity       :         s1, 2026-09-10, 14d
      Email preview    :         s2, after s1, 7d
      section Release
      Ship 2.0         :milestone, m1, after l2 s2, 0d
    Edit in playground
  • Timeline diagram rendered by ChartForgeX from its Mermaid source. Timeline diagram rendered by ChartForgeX from its Mermaid source, dark theme.

    Timeline

    Ordered events in authored periods and sections, without invented calendar durations.

    Source 9 lines
    Mermaidtimeline.mmd
    timeline
    title Delivery history
    section Discovery
    Before launch: Interview users
     : Review findings
    section Delivery
    Launch: Ship product<br>and docs : Invite users
    section Discovery
    After launch: Learn and improve
    Edit in playground
  • Journey diagram rendered by ChartForgeX from its Mermaid source. Journey diagram rendered by ChartForgeX from its Mermaid source, dark theme.

    Journey

    Task scores, actors and repeated authored sections.

    Source 8 lines
    Mermaidjourney.mmd
    journey
    title Support journey
    section Contact
    Open ticket: 2: Customer, Agent
    section Resolve
    Diagnose: 4: Agent
    section Contact
    Confirm recovery: 5: Customer, Agent
    Edit in playground
  • Kanban diagram rendered by ChartForgeX from its Mermaid source. Kanban diagram rendered by ChartForgeX from its Mermaid source, dark theme.

    Kanban

    Work items in board columns, with optional metadata.

    Source 11 lines
    Mermaidkanban.mmd
    ---
    title: Playground launch
    ---
    kanban
      todo[To do]
        docs[Write playground docs]
        share[Share links]
      doing[In progress]
        engine[WebAssembly engine]@{ priority: "High" }
      done[Done]
        site[chartforgex.com]
    Edit in playground
  • Git graph diagram rendered by ChartForgeX from its Mermaid source. Git graph diagram rendered by ChartForgeX from its Mermaid source, dark theme.

    Git graph

    Commits, branches, merges and tags.

    Source 12 lines
    Mermaidgitgraph.mmd
    ---
    title: Release 2.0 branch
    ---
    gitGraph
      commit id: "init"
      branch feature
      checkout feature
      commit id: "renderer"
      commit id: "tests"
      checkout main
      commit id: "docs"
      merge feature id: "merge" tag: "v2.0"
    Edit in playground
  • Swimlane diagram rendered by ChartForgeX from its Mermaid source. Swimlane diagram rendered by ChartForgeX from its Mermaid source, dark theme.

    Swimlane

    A process split into lanes by who owns each step.

    Source 15 lines
    Mermaidswimlane.mmd
    ---
    title: Pull request flow
    ---
    swimlane-beta LR
    subgraph Author
     A[Write source] --> B[Open pull request]
    end
    subgraph Build
     C{Checks pass?} --> D[Render report]
    end
    subgraph Reader
     E[Read in email]
    end
    B --> C
    D --> E
    Edit in playground
  • Use case diagram rendered by ChartForgeX from its Mermaid source. Use case diagram rendered by ChartForgeX from its Mermaid source, dark theme.

    Use case

    Actors and the use cases inside a system boundary.

    Source 14 lines
    Mermaidusecase.mmd
    ---
    title: Online store
    ---
    usecase-beta
    direction LR
    actor Customer
    systemBoundary Store[Online store]
     Browse("Browse products")
     Pay("Pay for order")
     Authenticate("Authenticate")
    end
    Customer --> Browse
    Browse ..> : include Authenticate
    Pay --|> Browse
    Edit in playground
  • Event modeling diagram rendered by ChartForgeX from its Mermaid source. Event modeling diagram rendered by ChartForgeX from its Mermaid source, dark theme.

    Event modeling

    Screens, commands, events and views across time frames.

    Source 14 lines
    Mermaideventmodeling.mmd
    ---
    title: Shopping cart events
    ---
    eventmodeling
    tf 01 ui CartUI
    tf 02 cmd AddItem
    tf 03 evt Cart.ItemAdded [[ItemAdded01]]
    tf 04 rmo Cart.CartView ->> 03
    rf 05 pcr InventoryProcessor
    timeframe 06 event Inventory.Reserved
    data ItemAdded01 `json`{
      "sku": "ABC",
      "quantity": 1
    }
    Edit in playground

Charts 6

  • Pie diagram rendered by ChartForgeX from its Mermaid source. Pie diagram rendered by ChartForgeX from its Mermaid source, dark theme.

    Pie

    Parts of a whole, with optional values.

    Source 6 lines
    Mermaidpie.mmd
    pie showData
      title Sign-ins by method
      "Passkey" : 8900
      "Authenticator app" : 6200
      "SMS code" : 1300
      "Password only" : 1500
    Edit in playground
  • XY chart diagram rendered by ChartForgeX from its Mermaid source. XY chart diagram rendered by ChartForgeX from its Mermaid source, dark theme.

    XY chart

    Bars and lines on shared category and value axes.

    Source 6 lines
    Mermaidxychart.mmd
    xychart-beta
      title "Tickets closed per sprint"
      x-axis [S1, S2, S3, S4, S5, S6, S7, S8]
      y-axis "Tickets" 0 --> 120
      bar [48, 61, 57, 72, 80, 77, 94, 103]
      line [48, 61, 57, 72, 80, 77, 94, 103]
    Edit in playground
  • Sankey diagram rendered by ChartForgeX from its Mermaid source. Sankey diagram rendered by ChartForgeX from its Mermaid source, dark theme.

    Sankey

    Flows between stages, sized by volume.

    Source 10 lines
    Mermaidsankey.mmd
    ---
    title: Sign-ins by network and method
    ---
    sankey-beta
    Office network,Passkey,5200
    Office network,Authenticator app,3100
    Remote,Passkey,3700
    Remote,Authenticator app,3100
    Remote,SMS code,1300
    Remote,Password only,1500
    Edit in playground
  • Radar diagram rendered by ChartForgeX from its Mermaid source. Radar diagram rendered by ChartForgeX from its Mermaid source, dark theme.

    Radar

    Several measures compared on radial axes.

    Source 7 lines
    Mermaidradar.mmd
    radar-beta
      title Security posture
      axis mail["Mail auth"], dnssec["DNSSEC"], tls["TLS"], ct["CT"], policy["Policy"]
      curve current["Current"]{91, 72, 88, 95, 79}
      curve target["Target"]{95, 90, 95, 95, 90}
      min 0
      max 100
    Edit in playground
  • Treemap diagram rendered by ChartForgeX from its Mermaid source. Treemap diagram rendered by ChartForgeX from its Mermaid source, dark theme.

    Treemap

    Hierarchical totals as nested rectangles.

    Source 11 lines
    Mermaidtreemap.mmd
    ---
    title: Device inventory
    ---
    treemap-beta
    "Infrastructure"
        "Identity": 42
        "Messaging": 18
        "Endpoints"
            "Windows": 24
            "macOS": 9
            "Linux": 6
    Edit in playground
  • Quadrant diagram rendered by ChartForgeX from its Mermaid source. Quadrant diagram rendered by ChartForgeX from its Mermaid source, dark theme.

    Quadrant

    Items placed on two axes split into four quadrants.

    Source 12 lines
    Mermaidquadrant.mmd
    quadrantChart
      title Feature priorities
      x-axis Low effort --> High effort
      y-axis Low impact --> High impact
      quadrant-1 Plan carefully
      quadrant-2 Do now
      quadrant-3 Maybe later
      quadrant-4 Avoid
      Dark theme: [0.25, 0.85]
      PNG export: [0.7, 0.8]
      Tooltips: [0.35, 0.4]
      Custom fonts: [0.8, 0.3]
    Edit in playground

Thinking tools 6

  • Mind map diagram rendered by ChartForgeX from its Mermaid source. Mind map diagram rendered by ChartForgeX from its Mermaid source, dark theme.

    Mind map

    Ideas branching out from a central topic.

    Source 17 lines
    Mermaidmindmap.mmd
    ---
    title: What ChartForgeX covers
    ---
    mindmap
      root((ChartForgeX))
        Outputs
          SVG
          PNG
          HTML
        Authoring
          Fluent C#
          Markdown fences
          Mermaid
        Hosts
          Reports
          Email
          Dashboards
    Edit in playground
  • Tree view diagram rendered by ChartForgeX from its Mermaid source. Tree view diagram rendered by ChartForgeX from its Mermaid source, dark theme.

    Tree view

    A folder or outline hierarchy.

    Source 11 lines
    Mermaidtreeview.mmd
    ---
    title: Repository layout
    ---
    treeView-beta
        "src"
            "ChartForgeX"
                "VisualBlocks"
            "ChartForgeX.Mermaid"
                "MermaidParser.cs"
                "MermaidTreeViewParser.cs"
        "README.md"
    Edit in playground
  • Venn diagram rendered by ChartForgeX from its Mermaid source. Venn diagram rendered by ChartForgeX from its Mermaid source, dark theme.

    Venn

    Proportional set circles, real intersections and reported area-fit limits.

    Source 6 lines
    Mermaidvenn.mmd
    venn-beta
    set A[First]: 100
    set B[Second]: 60
    union A,B[Shared]: 25
    style A fill:#ee4455,fill-opacity:0.25,stroke-width:3
    style A,B fill:#2233ff,fill-opacity:1,stroke:#112233,stroke-width:2
    Edit in playground
  • Ishikawa diagram rendered by ChartForgeX from its Mermaid source. Ishikawa diagram rendered by ChartForgeX from its Mermaid source, dark theme.

    Ishikawa

    Causes grouped by category behind one effect.

    Source 12 lines
    Mermaidishikawa.mmd
    ---
    title: Why the release slipped
    ---
    ishikawa-beta
    Delayed release
      People
        Handoffs
          Timezone gaps
      Process
        Late review
      Platform
        Slow build
    Edit in playground
  • Wardley diagram rendered by ChartForgeX from its Mermaid source. Wardley diagram rendered by ChartForgeX from its Mermaid source, dark theme.

    Wardley

    Components mapped by visibility and evolution.

    Source 22 lines
    Mermaidwardley.mmd
    wardley-beta
    title Platform map
    size [900, 600]
    evolution Genesis -> Custom Built -> Product -> Commodity
    anchor User [0.95, 0.05]
    component Portal [0.80, 0.35] inertia
    component API [0.70, 0.45] (build)
    component Identity [0.55, 0.65] label [-12, 18]
    User -> Portal
    Portal +'uses'> API
    API -.-> Identity;optional
    evolve API 0.75
    note "Operational pressure" [0.35, 0.75]
    annotations [0.12, 0.88]
    annotation 1, [0.60, 0.50] "Improve automation"
    accelerator Faster [0.42, 0.62]
    deaccelerator Risk [0.48, 0.68]
    pipeline API {
      component Build [0.30]
      component Buy [0.55]
      component Commodity [0.80]
    }
    Edit in playground
  • Cynefin diagram rendered by ChartForgeX from its Mermaid source. Cynefin diagram rendered by ChartForgeX from its Mermaid source, dark theme.

    Cynefin

    Situations sorted into Cynefin decision domains.

    Source 13 lines
    Mermaidcynefin.mmd
    cynefin-beta
    title Service decisions
    complex
     "Discover demand"
    complicated
     "Analyze capacity"
    chaotic
     "Contain outage"
    clear
     "Run checklist"
    confusion
     "Investigate context"
    complex --> complicated : "Learn"
    Edit in playground

Semantic fixtures use Mermaid.js 12.2.0, with additional reference lanes pinned to 10.9.8 and 11.17.2. These examples do not establish complete compatibility with every release or syntax form. The support matrix lists the documented syntax, native models and limits.

Use it from .NET

The atlas renders come from these calls. Install ChartForgeX.Mermaid for diagrams, and the Markdown bridge when documents hold mermaid fences.

Render Mermaid from C#

using ChartForgeX.Mermaid;
using ChartForgeX.VisualArtifacts;

MermaidRenderResult result = MermaidRenderer.Render(source);
if (!result.HasErrors && result.Artifact != null) {
    result.Artifact.SaveSvg("diagram.svg");
    result.Artifact.SavePng("diagram.png");
}

Check result.Diagnostics even when rendering succeeds. Warnings identify syntax or configuration that was kept without an exact visual interpretation.

Render Mermaid fences in Markdown

Add ChartForgeX.Markup.Mermaid when Markdown documents contain mermaid fences. The bridge keeps the dependency boundary clean: ChartForgeX.Mermaid owns parsing and conversion, and the markup bridge only adapts fence metadata and diagnostics.

using ChartForgeX.Markup.Mermaid;

var result = new MermaidVisualMarkupParser().Parse(markdown);

How rendering differs from Mermaid.js

  • Diagrams are laid out and drawn by ChartForgeX, so the output uses your ChartForgeX theme and typography rather than Mermaid's CSS.
  • The default and dark themes select native static palettes. Supported color and font variables configure native presentation roles; other theme settings retain diagnostics.
  • Accessible titles and descriptions from accTitle and accDescr become the SVG's accessible name and description.
  • Remote fonts are never fetched; native font resolution uses the registered fonts and fallbacks.

The support matrix lists each native model, supported grammar and remaining limitation. Journey retains task scores and actors; Timeline retains categorical periods without inventing dates. C4 preserves real hierarchy, and quantitative Venn fits report their residual limits. Railroad frontends share one native grammar scene, while Agentflow and ZenUML source remains inert diagram data.