Elytra
网站

Mermaid 图集:用 Pele 展示完整图表

从 Pele 官方 Examples 选取完整示例,展示 Git、时序、C4、状态机、思维导图、甘特图、桑基图等全部图种,并补充一张 CQRS 架构图。

这里以图为主。除单独标出的 CQRS 图外,下面直接选用 Pele 官方 Examples 及各图种示例页中的完整源码,保留英文标签、子图、长文本、分支和数值。仅将完整桑基图的画布调高,给密集节点更多空间。整理于 2026 年 10 月 21 日。

右键或长按图表可切换渲染器;默认使用 Pele。每张图右上角都能缩放、适应宽度和弹窗查看。复杂图推荐放大看。Beautiful Mermaid 不支持的类型会显示源码与失败提示。

这些是渲染示例,数值、历史叙述、系统架构与任务状态沿用原样本,不作为现实数据引用。部分示例的外部图标需要调用方提供图标资源,本站未配置的图标可能省略。综合组件样本见 MDX 组件展示,引擎说明见 Pele 渲染引擎解析。

1CQRS:命令、事件与读模型

这张图为本站补充的架构示意,展示命令处理、事件存储、Outbox、消息重试、投影与查询侧的连接;它不是 Pele 的独立图种,使用 Flowchart 绘制。

Loading diagram…

Mermaid 源代码

flowchart LR
  User[Web / Mobile Client]
  subgraph Commands[Command side]
    API[Command API]
    Auth{Authorization}
    Handler[Command Handler]
    Aggregate[Order Aggregate]
    Rules{Business Rules}
    Store[(Event Store)]
    Outbox[(Transactional Outbox)]
    API --> Auth
    Auth -->|allowed| Handler
    Auth -->|denied| Rejected[Reject Request]
    Handler --> Aggregate --> Rules
    Rules -->|valid| Store
    Rules -->|invalid| Rejected
    Store --> Outbox
  end
  subgraph Events[Event distribution]
    Relay[Outbox Relay]
    Bus[Event Bus]
    Retry[Retry Queue]
    Dead[(Dead Letter Queue)]
    Relay --> Bus
    Bus -->|temporary failure| Retry
    Retry -->|retry| Bus
    Retry -->|limit exceeded| Dead
  end
  subgraph Queries[Query side]
    Projection[Order Projection]
    Search[Index Projection]
    ReadDB[(Read Database)]
    Index[(Search Index)]
    QueryAPI[Query API]
    Cache[(Response Cache)]
    Projection --> ReadDB
    Search --> Index
    QueryAPI --> ReadDB
    QueryAPI --> Index
    QueryAPI <-->|cache| Cache
  end
  User -->|PlaceOrder| API
  Outbox --> Relay
  Bus -->|OrderPlaced| Projection
  Bus -->|OrderPlaced| Search
  Bus -->|OrderPlaced| Email[Notification Worker]
  User -->|GetOrder / SearchOrders| QueryAPI
  QueryAPI -->|read model| User
  Store -. replay events .-> Projection

可选择文字复制;按 Esc 或点击空白处关闭。

2Block

嵌套分组、跨列与布局占位。 官方示例。

Loading diagram…

Mermaid 源代码

block
  blockArrowId<["Label"]>(right)
  blockArrowId2<["Label"]>(left)
  blockArrowId3<["Label"]>(up)
  blockArrowId4<["Label"]>(down)
  blockArrowId5<["Label"]>(x)
  blockArrowId6<["Label"]>(y)
  blockArrowId7<["Label"]>(x, down)

可选择文字复制;按 Esc 或点击空白处关闭。

3C4

银行系统的组件、边界、外部依赖与关系标注。 官方示例。

Loading diagram…

Mermaid 源代码

C4Component
    title Component diagram for Internet Banking System - API Application

    Container(spa, "Single Page Application", "javascript and angular", "Provides all the internet banking functionality to customers via their web browser.")
    Container(ma, "Mobile App", "Xamarin", "Provides a limited subset to the internet banking functionality to customers via their mobile device.")
    ContainerDb(db, "Database", "Relational Database Schema", "Stores user registration information, hashed authentication credentials, access logs, etc.")
    System_Ext(mbs, "Mainframe Banking System", "Stores all of the core banking information about customers, accounts, transactions, etc.")

    Container_Boundary(api, "API Application") {
        Component(sign, "Sign In Controller", "MVC Rest Controller", "Allows users to sign in to the internet banking system")
        Component(accounts, "Accounts Summary Controller", "MVC Rest Controller", "Provides customers with a summary of their bank accounts")
        Component(security, "Security Component", "Spring Bean", "Provides functionality related to singing in, changing passwords, etc.")
        Component(mbsfacade, "Mainframe Banking System Facade", "Spring Bean", "A facade onto the mainframe banking system.")

        Rel(sign, security, "Uses")
        Rel(accounts, mbsfacade, "Uses")
        Rel(security, db, "Read & write to", "JDBC")
        Rel(mbsfacade, mbs, "Uses", "XML/HTTPS")
    }

    Rel_Back(spa, sign, "Uses", "JSON/HTTPS")
    Rel(spa, accounts, "Uses", "JSON/HTTPS")

    Rel(ma, sign, "Uses", "JSON/HTTPS")
    Rel(ma, accounts, "Uses", "JSON/HTTPS")

    UpdateRelStyle(spa, sign, $offsetY="-40")
    UpdateRelStyle(spa, accounts, $offsetX="40", $offsetY="40")

    UpdateRelStyle(ma, sign, $offsetX="-90", $offsetY="40")
    UpdateRelStyle(ma, accounts, $offsetY="-40")

        UpdateRelStyle(sign, security, $offsetX="-160", $offsetY="10")
        UpdateRelStyle(accounts, mbsfacade, $offsetX="140", $offsetY="10")
        UpdateRelStyle(security, db, $offsetY="-40")
        UpdateRelStyle(mbsfacade, mbs, $offsetY="-40")

可选择文字复制;按 Esc 或点击空白处关闭。

4Class

命名空间、继承、字段、方法和注释。 官方示例。

4.1示例 1

Loading diagram…

Mermaid 源代码

---
title: Reef animal example
---
classDiagram
    note "From Turtle till Whale"
    Animal <|-- Turtle
    note for Turtle "can swim<br>can dive<br>can nest on beaches<br>can live for decades"
    Animal <|-- Shark
    Animal <|-- Whale
    Animal : +int age
    Animal : +String name
    Animal: +isMammal()
    Animal: +migrate()
    class Turtle{
        +String shellColor
        +swim()
        +nest()
    }
    class Shark{
        -int sizeInFeet
        -canHunt()
    }
    class Whale{
        +bool is_humpback
        +sing()
    }

可选择文字复制;按 Esc 或点击空白处关闭。

4.2示例 2

Loading diagram…

Mermaid 源代码

---
config:
  class:
    hierarchicalNamespaces: false
---
classDiagram
    namespace Earth.Volcano.Summit {
        class Crater {
            +erupt()
        }
    }
    namespace Earth.Volcano.Slope {
        class LavaFlow {
            +buildLand()
        }
    }
    namespace Earth {
        class Hotspot {
            +meltRock()
        }
    }
    Hotspot --> Crater : feeds
    Hotspot --> LavaFlow : feeds

可选择文字复制;按 Esc 或点击空白处关闭。

5Entity relationship

实体字段、主外键和关系基数。 官方示例。

Loading diagram…

Mermaid 源代码

erDiagram
    CAR ||--o{ NAMED-DRIVER : allows
    CAR {
        string registrationNumber PK
        string make
        string model
        string[] parts
    }
    PERSON ||--o{ NAMED-DRIVER : is
    PERSON {
        string driversLicense PK "The license #"
        string(99) firstName "Only 99 characters are allowed"
        string lastName
        string phone UK
        int age
    }
    NAMED-DRIVER {
        string carRegistrationNumber PK, FK
        string driverLicense PK, FK
    }
    MANUFACTURER only one to zero or more CAR : makes

可选择文字复制;按 Esc 或点击空白处关闭。

6Event modeling

命令、事件、处理器与读模型的时间顺序。 官方示例。

6.1示例 1

Loading diagram…

Mermaid 源代码

eventmodeling

timeframe 01 ui CartUI
timeframe 02 command AddItem [[AddItem01]]
timeframe 03 event ItemAdded [[ItemAdded]]
timeframe 04 command AddItem [[AddItem02]]
timeframe 05 event ItemAdded [[ItemAdded]]

data AddItem01 {
  description: 'john'
  image: 'avatar_john'
  price: 20.4
}

data AddItem02 {
  description: 'jack'
  image: 'avatar_jack'
  price: 12.5
}

data ItemAdded {
  description: string
  image: string
  price: number
}

可选择文字复制;按 Esc 或点击空白处关闭。

6.2示例 2

Loading diagram…

Mermaid 源代码

eventmodeling

timeframe 01 ui CartUI
timeframe 02 command AddItem
timeframe 03 event ItemAdded

resetframe 04 event External.InventoryChanged
timeframe 05 processor InventoryProcessor
timeframe 06 command ChangeInventory
timeframe 07 event Cart.InventoryChanged

可选择文字复制;按 Esc 或点击空白处关闭。

7Flowchart

子图、跨边界连接和不同方向的混合布局。 官方示例。

7.1示例 1

Loading diagram…

Mermaid 源代码

flowchart LR
    subgraph subgraph1
        direction TB
        top1[top] --> bottom1[bottom]
    end
    subgraph subgraph2
        direction TB
        top2[top] --> bottom2[bottom]
    end
    %% ^ These subgraphs are identical, except for the links to them:

    %% Link *to* subgraph1: subgraph1 direction is maintained
    outside --> subgraph1
    %% Link *within* subgraph2:
    %% subgraph2 inherits the direction of the top-level graph (LR)
    outside ---> top2

可选择文字复制;按 Esc 或点击空白处关闭。

7.2示例 2

Loading diagram…

Mermaid 源代码

---
config:
  theme: default
  look: classic
  layout: dagre
---
flowchart LR
  subgraph Client
    UI[Web app]
    Cache[(Local cache)]
  end
  subgraph Services
    API[API gateway]
    Auth[Auth service]
    Orders[Order service]
  end
  subgraph Storage
    DB[(Orders DB)]
  end
  UI --> API
  UI --> Cache
  API --> Auth
  API --> Orders
  Orders --> DB
  Auth -. token .-> UI

可选择文字复制;按 Esc 或点击空白处关闭。

8Gantt

多个工作区间、任务状态、依赖和里程碑。 官方示例。

Loading diagram…

Mermaid 源代码

gantt
    dateFormat  YYYY-MM-DD
    title       Adding GANTT diagram functionality to mermaid
    excludes    weekends
    %% (`excludes` accepts specific dates in YYYY-MM-DD format, days of the week ("sunday") or "weekends", but not the word "weekdays".)

    section A section
    Completed task            :done,    des1, 2014-01-06,2014-01-08
    Active task               :active,  des2, 2014-01-09, 3d
    Future task               :         des3, after des2, 5d
    Future task2              :         des4, after des3, 5d

    section Critical tasks
    Completed task in the critical line :crit, done, 2014-01-06,24h
    Implement parser and jison          :crit, done, after des1, 2d
    Create tests for parser             :crit, active, 3d
    Future task in critical line        :crit, 5d
    Create tests for renderer           :2d
    Add to mermaid                      :until isadded
    Functionality added                 :milestone, isadded, 2014-01-25, 0d

    section Documentation
    Describe gantt syntax               :active, a1, after des1, 3d
    Add gantt diagram to demo page      :after a1  , 20h
    Add another diagram to demo page    :doc1, after a1  , 48h

    section Last section
    Describe gantt syntax               :after doc1, 3d
    Add gantt diagram to demo page      :20h
    Add another diagram to demo page    :48h

可选择文字复制;按 Esc 或点击空白处关闭。

9Git graph

多分支开发、合并、提交标记与历史拓扑。 官方示例。

Loading diagram…

Mermaid 源代码

---
config:
  logLevel: 'debug'
  theme: 'neutral'
---
      gitGraph
        commit
        branch hotfix
        checkout hotfix
        commit
        branch develop
        checkout develop
        commit id:"ash" tag:"abc"
        branch featureB
        checkout featureB
        commit type:HIGHLIGHT
        checkout main
        checkout hotfix
        commit type:NORMAL
        checkout develop
        commit type:REVERSE
        checkout featureB
        commit
        checkout main
        merge hotfix
        checkout featureB
        commit
        checkout develop
        branch featureA
        commit
        checkout develop
        merge hotfix
        checkout featureA
        commit
        checkout featureB
        commit
        checkout develop
        merge featureA
        branch release
        checkout release
        commit
        checkout main
        commit
        checkout release
        merge main
        checkout develop
        merge release

可选择文字复制;按 Esc 或点击空白处关闭。

10Kanban

跨列任务、负责人、优先级与工单信息。 官方示例。

Loading diagram…

Mermaid 源代码

---
config:
  kanban:
    ticketBaseUrl: 'https://mermaidchart.atlassian.net/browse/#TICKET#'
---
kanban
  Todo
    [Create Documentation]
    docs[Create Blog about the new diagram]
  [In progress]
    id6[Create renderer so that it works in all cases. We also add some extra text here for testing purposes. And some more just for the extra flare.]
  id9[Ready for deploy]
    id8[Design grammar]@{ assigned: 'knsv' }
  id10[Ready for test]
    id4[Create parsing tests]@{ ticket: MC-2038, assigned: 'K.Sveidqvist', priority: 'High' }
    id66[last item]@{ priority: 'Very Low', assigned: 'knsv' }
  id11[Done]
    id5[define getData]
    id2[Title of diagram is more than 100 chars when user duplicates diagram with 100 char]@{ ticket: MC-2036, priority: 'Very High'}
    id3[Update DB function]@{ ticket: MC-2037, assigned: knsv, priority: 'High' }

  id12[Can't reproduce]
    id3[Weird flickering in Firefox]

可选择文字复制;按 Esc 或点击空白处关闭。

11Mindmap

多级分支、长标签与不同形状。 官方示例。

Loading diagram…

Mermaid 源代码

mindmap
  root((mindmap))
    Origins
      Long history
      ::icon(fa fa-book)
      Popularization
        British popular psychology author Tony Buzan
    Research
      On effectiveness<br/>and features
      On Automatic creation
        Uses
            Creative techniques
            Strategic planning
            Argument mapping
    Tools
      Pen and paper
      Mermaid

可选择文字复制;按 Esc 或点击空白处关闭。

12Packet

完整 TCP 数据包的位域和字段布局。 官方示例。

Loading diagram…

Mermaid 源代码

---
title: "TCP Packet"
---
packet
0-15: "Source Port"
16-31: "Destination Port"
32-63: "Sequence Number"
64-95: "Acknowledgment Number"
96-99: "Data Offset"
100-105: "Reserved"
106: "URG"
107: "ACK"
108: "PSH"
109: "RST"
110: "SYN"
111: "FIN"
112-127: "Window"
128-143: "Checksum"
144-159: "Urgent Pointer"
160-191: "(Options and Padding)"
192-255: "Data (variable length)"

可选择文字复制;按 Esc 或点击空白处关闭。

13Pie

多个分类与数值标签的排布。 官方示例。

Loading diagram…

Mermaid 源代码

---
config:
  pie:
    textPosition: 0.5
    donutHole: 0.2
    highlightSlice: Potassium
  themeVariables:
    pieOuterStrokeWidth: "5px"
---
pie showData
    title Key elements in Product X
    "Calcium" : 42.96
    "Potassium" : 50.05
    "Magnesium" : 10.01
    "Iron" :  5

可选择文字复制;按 Esc 或点击空白处关闭。

14Quadrant chart

轴、四象限说明与多个坐标点。 官方示例。

Loading diagram…

Mermaid 源代码

quadrantChart
    title Reach and engagement of campaigns
    x-axis Low Reach --> High Reach
    y-axis Low Engagement --> High Engagement
    quadrant-1 We should expand
    quadrant-2 Need to promote
    quadrant-3 Re-evaluate
    quadrant-4 May be improved
    Campaign A: [0.3, 0.6]
    Campaign B: [0.45, 0.23]
    Campaign C: [0.57, 0.69]
    Campaign D: [0.78, 0.34]
    Campaign E: [0.40, 0.34]
    Campaign F: [0.35, 0.78]

可选择文字复制;按 Esc 或点击空白处关闭。

15Requirement

需求、风险、验证方式与满足关系。 官方示例。

Loading diagram…

Mermaid 源代码

---
config:
  theme: default
  look: classic
  layout: dagre
---
requirementDiagram
  requirement checkout_req {
    id: 1
    text: Orders must be payable online.
    risk: high
    verifymethod: test
  }
  functionalRequirement payment_req {
    id: 1.1
    text: Card payments must be authorized.
    risk: high
    verifymethod: test
  }
  element checkout_service {
    type: service
  }
  checkout_req - contains -> payment_req
  checkout_service - satisfies -> payment_req

可选择文字复制;按 Esc 或点击空白处关闭。

16Sankey

完整能源网络:来源、转换、损耗与最终用途。 官方示例。

Loading diagram…

Mermaid 源代码

---
config:
  sankey:
    showValues: false
    height: 800
---
sankey

Agricultural 'waste',Bio-conversion,124.729
Bio-conversion,Liquid,0.597
Bio-conversion,Losses,26.862
Bio-conversion,Solid,280.322
Bio-conversion,Gas,81.144
Biofuel imports,Liquid,35
Biomass imports,Solid,35
Coal imports,Coal,11.606
Coal reserves,Coal,63.965
Coal,Solid,75.571
District heating,Industry,10.639
District heating,Heating and cooling - commercial,22.505
District heating,Heating and cooling - homes,46.184
Electricity grid,Over generation / exports,104.453
Electricity grid,Heating and cooling - homes,113.726
Electricity grid,H2 conversion,27.14
Electricity grid,Industry,342.165
Electricity grid,Road transport,37.797
Electricity grid,Agriculture,4.412
Electricity grid,Heating and cooling - commercial,40.858
Electricity grid,Losses,56.691
Electricity grid,Rail transport,7.863
Electricity grid,Lighting & appliances - commercial,90.008
Electricity grid,Lighting & appliances - homes,93.494
Gas imports,Ngas,40.719
Gas reserves,Ngas,82.233
Gas,Heating and cooling - commercial,0.129
Gas,Losses,1.401
Gas,Thermal generation,151.891
Gas,Agriculture,2.096
Gas,Industry,48.58
Geothermal,Electricity grid,7.013
H2 conversion,H2,20.897
H2 conversion,Losses,6.242
H2,Road transport,20.897
Hydro,Electricity grid,6.995
Liquid,Industry,121.066
Liquid,International shipping,128.69
Liquid,Road transport,135.835
Liquid,Domestic aviation,14.458
Liquid,International aviation,206.267
Liquid,Agriculture,3.64
Liquid,National navigation,33.218
Liquid,Rail transport,4.413
Marine algae,Bio-conversion,4.375
Ngas,Gas,122.952
Nuclear,Thermal generation,839.978
Oil imports,Oil,504.287
Oil reserves,Oil,107.703
Oil,Liquid,611.99
Other waste,Solid,56.587
Other waste,Bio-conversion,77.81
Pumped heat,Heating and cooling - homes,193.026
Pumped heat,Heating and cooling - commercial,70.672
Solar PV,Electricity grid,59.901
Solar Thermal,Heating and cooling - homes,19.263
Solar,Solar Thermal,19.263
Solar,Solar PV,59.901
Solid,Agriculture,0.882
Solid,Thermal generation,400.12
Solid,Industry,46.477
Thermal generation,Electricity grid,525.531
Thermal generation,Losses,787.129
Thermal generation,District heating,79.329
Tidal,Electricity grid,9.452
UK land based bioenergy,Bio-conversion,182.01
Wave,Electricity grid,19.013
Wind,Electricity grid,289.366

可选择文字复制;按 Esc 或点击空白处关闭。

17Sequence

参与者、激活区间、消息与交互片段。 官方示例。

17.1示例 1

Loading diagram…

Mermaid 源代码

---
config:
  theme: default
  look: classic
---
sequenceDiagram
  autonumber
  actor Customer
  participant Web as Web app
  participant API as API gateway
  participant Bank
  Customer->>Web: Place order
  Web->>API: POST /orders
  activate API
  API->>Bank: Authorize payment
  Bank-->>API: Approved
  API-->>Web: 201 Created
  deactivate API
  Web-->>Customer: Order confirmed
  Note over Customer,Bank: One order, one transaction

可选择文字复制;按 Esc 或点击空白处关闭。

17.2示例 2

Loading diagram…

Mermaid 源代码

sequenceDiagram
    Alice->>Bob: Hello Bob, how are you?
    alt is sick
        Bob->>Alice: Not so good :(
    else is well
        Bob->>Alice: Feeling fresh like a daisy
    end
    opt Extra response
        Bob->>Alice: Thanks for asking
    end

可选择文字复制;按 Esc 或点击空白处关闭。

18State

嵌套状态、并行区域与事件转换。 官方示例。

18.1示例 1

Loading diagram…

Mermaid 源代码

stateDiagram-v2
    [*] --> Active

    state Active {
        [*] --> NumLockOff
        NumLockOff --> NumLockOn : EvNumLockPressed
        NumLockOn --> NumLockOff : EvNumLockPressed
        --
        [*] --> CapsLockOff
        CapsLockOff --> CapsLockOn : EvCapsLockPressed
        CapsLockOn --> CapsLockOff : EvCapsLockPressed
        --
        [*] --> ScrollLockOff
        ScrollLockOff --> ScrollLockOn : EvScrollLockPressed
        ScrollLockOn --> ScrollLockOff : EvScrollLockPressed
    }

可选择文字复制;按 Esc 或点击空白处关闭。

18.2示例 2

Loading diagram…

Mermaid 源代码

---
config:
  theme: default
  look: classic
  layout: dagre
---
stateDiagram-v2
  [*] --> Draft
  Draft --> Submitted : submit
  state Review {
    [*] --> Screening
    Screening --> Decision
  }
  Submitted --> Review
  Review --> Published : approved
  Review --> Draft : rejected
  Published --> [*]

可选择文字复制;按 Esc 或点击空白处关闭。

19Timeline

分期、多行事件与长文本。 官方示例。

Loading diagram…

Mermaid 源代码

timeline
        title Hawaiʻi's History Timeline
        section Voyagers
          1000 AD : Polynesian voyagers reach Hawaiʻi in sailing canoes
          1778 : Captain Cook lands on Kauaʻi.<br> Islanders and Europeans meet for the first time.
        section Kingdom
          1810 : King Kamehameha unites the islands. <br>They are ruled as one kingdom for the first time.
                  : Ships from around the world stop to trade.
          1882 : ʻIolani Palace is completed in Honolulu.<br> It soon has electric lights and telephones.
                  : Most people in the kingdom can read and write.

可选择文字复制;按 Esc 或点击空白处关闭。

20User journey

阶段、参与者与任务体验评分。 官方示例。

Loading diagram…

Mermaid 源代码

journey
    title My working day
    section Go to work
      Make tea: 5: Me
      Go upstairs: 3: Me
      Do work: 1: Me, Cat
    section Go home
      Go downstairs: 5: Me
      Sit down: 5: Me

可选择文字复制;按 Esc 或点击空白处关闭。

21XY chart

组合图层、坐标轴与多组数值。 官方示例。

Loading diagram…

Mermaid 源代码

---
config:
    xyChart:
        width: 900
        height: 600
        showDataLabel: true
    themeVariables:
        xyChart:
            titleColor: "#ff0000"
---
xychart
    title "Sales Revenue"
    x-axis [jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec]
    y-axis "Revenue (in $)" 4000 --> 11000
    bar [5000, 6000, 7500, 8200, 9500, 10500, 11000, 10200, 9200, 8500, 7000, 6000]
    line [5000, 6000, 7500, 8200, 9500, 10500, 11000, 10200, 9200, 8500, 7000, 6000]

可选择文字复制;按 Esc 或点击空白处关闭。

22Agentflow

嵌套代理、工具调用、连接器与引用资料。 官方示例。

Loading diagram…

Mermaid 源代码

agentflow-beta TB
  connector llm["LLM API"]
  llm@{ protocol: "http", endpoint: "https://api.example.com/chat" }

  flow coffee_team["Coffee Team"]
    city["city"]@{ shape: input, value: "Stockholm" }

    flow researcher["Researcher"]
      research["research_location"]@{ shape: tool, params: "city :: String", returns: "Report" }
      write["write_copy"]@{ shape: tool, connectorRef: "llm.chat", returns: "CoffeeCopy" }
      city --> research --> write
    end
    researcher@{ instruction: "Research the city and draft English coffee copy citing sources." }

    flow designer["Designer"]
      render["generate_html"]@{ shape: tool, connectorRef: "llm.chat", returns: "String" }
      brand["Nordic Brand Guide"]@{ shape: refdoc }
      render -.- brand
    end

    researcher --> designer
  end

可选择文字复制;按 Esc 或点击空白处关闭。

23Architecture

多组服务、存储、连接方向与对齐约束。 官方示例。

23.1示例 1

Loading diagram…

Mermaid 源代码

architecture-beta
    group sources(cloud)[Sources]
        service src_a(server)[Source A] in sources
        service src_b(server)[Source B] in sources
        service src_c(server)[Source C] in sources

    group storage(database)[Storage]
        service db_one(database)[DB One] in storage
        service db_two(database)[DB Two] in storage
        service db_three(database)[DB Three] in storage

    group output(disk)[Output]
        service brief(disk)[Brief] in output
        service analyst(server)[Analyst] in output
        service delivery(cloud)[Delivery] in output

    src_a:B --> T:db_one
    src_b:B --> T:db_two
    src_c:B --> T:db_three
    db_two:B --> T:brief
    brief:R --> L:analyst
    analyst:R --> L:delivery

    align row src_a src_b src_c
    align row db_one db_two db_three
    align row brief analyst delivery

    align column src_a db_one
    align column src_b db_two brief
    align column src_c db_three

可选择文字复制;按 Esc 或点击空白处关闭。

23.2示例 2

Loading diagram…

Mermaid 源代码

architecture-beta
    service left_disk(disk)[Disk]
    service top_disk(disk)[Disk]
    service bottom_disk(disk)[Disk]
    service top_gateway(internet)[Gateway]
    service bottom_gateway(internet)[Gateway]
    junction junctionCenter
    junction junctionRight

    left_disk:R -- L:junctionCenter
    top_disk:B -- T:junctionCenter
    bottom_disk:T -- B:junctionCenter
    junctionCenter:R -- L:junctionRight
    top_gateway:B -- T:junctionRight
    bottom_gateway:T -- B:junctionRight

可选择文字复制;按 Esc 或点击空白处关闭。

24Cynefin

分类域与域之间的演化关系。 官方示例。

Loading diagram…

Mermaid 源代码

cynefin-beta
  title Strategy Categorization

  complex
    "Market research"

  complicated
    "Competitive analysis"

  clear
    "Standard pricing"

  chaotic
    "Crisis management"

  complex --> complicated : "Pattern identified"
  complicated --> clear : "Best practice codified"
  clear --> chaotic : "Complacency"
  chaotic --> complex : "Stabilized"

可选择文字复制;按 Esc 或点击空白处关闭。

25Ishikawa

多级原因分解的鱼骨结构。 官方示例。

Loading diagram…

Mermaid 源代码

ishikawa-beta
    Blurry Photo
    Process
        Out of focus
        Shutter speed too slow
        Protective film not removed
        Beautification filter applied
    User
        Shaky hands
    Equipment
        LENS
            Inappropriate lens
            Damaged lens
            Dirty lens
        SENSOR
            Damaged sensor
            Dirty sensor
    Environment
        Subject moved too quickly
        Too dark

可选择文字复制;按 Esc 或点击空白处关闭。

26Radar

多轴、多曲线与网格。 官方示例。

Loading diagram…

Mermaid 源代码

radar-beta
  title Restaurant Comparison
  axis food["Food Quality"], service["Service"], price["Price"]
  axis ambiance["Ambiance"]

  curve a["Restaurant A"]{4, 3, 2, 4}
  curve b["Restaurant B"]{3, 4, 3, 3}
  curve c["Restaurant C"]{2, 3, 4, 2}
  curve d["Restaurant D"]{2, 2, 4, 3}

  graticule polygon
  max 5

可选择文字复制;按 Esc 或点击空白处关闭。

27Railroad

表达式文法中的选择、重复和嵌套。 官方示例。

27.1示例 1

Loading diagram…

Mermaid 源代码

railroad-beta
title Expression Grammar

expression = sequence(
    nonterminal("term"),
    zeroOrMore(sequence(
        choice(terminal("+"), terminal("-")),
        nonterminal("term")
    ))
) ;
term = sequence(
    nonterminal("factor"),
    zeroOrMore(sequence(
        choice(terminal("*"), terminal("/")),
        nonterminal("factor")
    ))
) ;
factor = choice(
    nonterminal("number"),
    sequence(terminal("("), nonterminal("expression"), terminal(")"))
) ;
number = oneOrMore(nonterminal("digit")) ;
digit = choice(terminal("0"), terminal("1"), terminal("2"), terminal("3"), terminal("4"), terminal("5"), terminal("6"), terminal("7"), terminal("8"), terminal("9")) ;

可选择文字复制;按 Esc 或点击空白处关闭。

27.2示例 2

Loading diagram…

Mermaid 源代码

railroad-ebnf-beta
title "Arithmetic Expression Grammar"

expression = term ( ( "+" | "-" ) term )* ;
term = factor ( ( "*" | "/" ) factor )* ;
factor = number | "(" expression ")" ;
number = digit+ ;
digit = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" ;

可选择文字复制;按 Esc 或点击空白处关闭。

28Swimlane

多个角色泳道中的交接、分支与回路。 官方示例。

Loading diagram…

Mermaid 源代码

swimlane-beta LR
  subgraph Customer
    request[Request service]
    receive[Receive update]
  end

  subgraph Support
    triage[Triage request]
    answer[Send answer]
  end

  subgraph Engineering
    investigate[Investigate issue]
    fix[Prepare fix]
  end

  request --> triage
  triage -->|Known issue| answer
  triage -->|Needs code change| investigate
  investigate --> fix --> answer
  answer --> receive

可选择文字复制;按 Esc 或点击空白处关闭。

29Tree view

目录层级、图标配置与文件说明。 官方示例。

Loading diagram…

Mermaid 源代码

---
config:
  treeView:
    showIcons: true
    defaultIconPack: material-icon-theme
    filenameIcons:
      Dockerfile: docker
    extensionIcons:
      .ts: typescript
      .tsx: react-ts
      .txt: none
---
treeView-beta
    src/
        App.tsx
        utils.ts
    Dockerfile
    notes.txt
    README.md

可选择文字复制;按 Esc 或点击空白处关闭。

30Treemap

层级数值如何分割面积。 官方示例。

Loading diagram…

Mermaid 源代码

---
config:
  treemap:
    valueFormat: '$0,0'
---
treemap-beta
"Budget"
    "Operations"
        "Salaries": 700000
        "Equipment": 200000
        "Supplies": 100000
    "Marketing"
        "Advertising": 400000
        "Events": 100000

可选择文字复制;按 Esc 或点击空白处关闭。

31Use case

角色、系统边界、用例与包含关系。 官方示例。

Loading diagram…

Mermaid 源代码

---
config:
  usecase:
    actorFontSize: 16
    actorFontFamily: Arial
    actorFontWeight: bold
    usecaseFontSize: 14
    usecaseFontFamily: Georgia
    usecaseFontWeight: normal
    nodeSpacing: 60
    rankSpacing: 70
    diagramPadding: 24
    colorScheme: role
    useMaxWidth: false
---
usecase-beta
direction LR
actor Customer
Browse("Browse catalog")
Customer --> Browse

可选择文字复制;按 Esc 或点击空白处关闭。

32Venn

多个集合、交集标签与集合内文本。 官方示例。

32.1示例 1

Loading diagram…

Mermaid 源代码

---
config:
  theme: default
  look: classic
---
venn-beta
  title What makes a good feature
  set Desirable
  set Feasible
  set Viable
  union Desirable,Feasible["Buildable"]
  union Feasible,Viable["Sustainable"]
  union Desirable,Viable["Marketable"]
  union Desirable,Feasible,Viable["Ship it"]

可选择文字复制;按 Esc 或点击空白处关闭。

32.2示例 2

Loading diagram…

Mermaid 源代码

venn-beta
  set A["Frontend"]
    text A1["React"]
    text A2["Design Systems"]
  set B["Backend"]
    text B1["API"]
  union A,B["Shared"]
    text AB1["OpenAPI"]

可选择文字复制;按 Esc 或点击空白处关闭。

33Wardley map

价值链、演化位置与采购策略。 官方示例。

33.1示例 1

Loading diagram…

Mermaid 源代码

wardley-beta
title Tea Shop Value Chain

anchor Business [0.95, 0.63]
component Cup of Tea [0.79, 0.61]
component Tea [0.63, 0.81]
component Hot Water [0.52, 0.80]
component Kettle [0.43, 0.35]
component Power [0.10, 0.70]

Business -> Cup of Tea
Cup of Tea -> Tea
Cup of Tea -> Hot Water
Hot Water -> Kettle
Kettle -> Power

evolve Kettle 0.62
evolve Power 0.89

note "Standardizing power allows Kettles to evolve faster" [0.30, 0.49]

可选择文字复制;按 Esc 或点击空白处关闭。

33.2示例 2

Loading diagram…

Mermaid 源代码

wardley-beta
title Sourcing Strategy

anchor Customer [0.80, 0.95]
component Custom App [0.45, 0.85] (build)
component Off-the-shelf Tool [0.85, 0.65] (buy)
component Managed Service [0.60, 0.40] (outsource)
component Cloud Platform [0.95, 0.25] (market)

Customer -> Custom App
Custom App -> Off-the-shelf Tool
Custom App -> Managed Service
Off-the-shelf Tool -> Cloud Platform

可选择文字复制;按 Esc 或点击空白处关闭。

34示例来源与许可

上述官方示例来自 obsidianmd/pele 的文档,版权归原作者所有。下列声明随示例保留;CQRS 图和本页中文导览由 GPT-6 整理。

CONTINUE EXPLORING

沿着这篇文章继续

在地图中查看

欢迎补充、提问,或分享不同的看法。使用 GitHub 账号登录后即可评论。

On this page