> For the complete documentation index, see [llms.txt](https://gitbook.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://gitbook.com/docs/documentation/zh/chuang-jian-nei-rong/blocks/mermaid-blocks.md).

# Mermaid 块

添加 Mermaid 块，使用 Mermaid 语法在 GitBook 中创建图表

Mermaid 块可让你使用 [Mermaid](https://mermaid.ai/) 语法创建图表。

如果你想以易于更新的格式展示流程、时序、状态或关系，可以使用 Mermaid 块。

### 添加 Mermaid 块

1. 将光标放在空行上，然后输入 `/`.
2. 点击 **Mermaid** 。
3. 输入或粘贴 Mermaid 语法。GitBook 会自动渲染图表。

你也可以点击编辑器中任意一行左侧的 **+** ，然后点击 **Mermaid**.

### 示例

```mermaid
flowchart TD
    A[打开插入面板] --> B[选择 Mermaid]
    B --> C[添加 Mermaid 语法]
    C --> D[GitBook 渲染图表]
```

### Markdown 表示

````markdown
```mermaid
flowchart TD
    A[打开插入面板] --> B[选择 Mermaid]
    B --> C[添加 Mermaid 语法]
    C --> D[GitBook 渲染图表]
```
````

GitBook 会将带有 `mermaid` 语言标识符的代码块渲染为原生 Mermaid 块。<br>

### 故障排除

如果 Mermaid 图表未能渲染，请检查以下常见原因：

* **语法错误** ——检查 Mermaid 代码是否有拼写错误，对照 Mermaid 文档中的示例，或在 [Mermaid Live Editor](https://mermaid.live/) 中测试，以排查问题。
* **使用了代码块而非 Mermaid 块** ——Mermaid 代码无法在标准代码块中渲染。按 `/` ，然后选择 **Mermaid 图表** 以插入正确类型的块。
* **较早创建的 Mermaid 内容** ——Mermaid 是原生块，无需集成。如果你在支持原生块之前创建了 Mermaid 内容，GitBook 会在你下次编辑页面时自动将其转换。


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://gitbook.com/docs/documentation/zh/chuang-jian-nei-rong/blocks/mermaid-blocks.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
