> ## Documentation Index
> Fetch the complete documentation index at: https://iso-topology.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# 选择格式、安排布局并检查结果

> 用 YAML、布局模式、分组、端口和主题完成常见架构图任务。

D2 适合简洁关系图；YAML 适合 Agent 修复和 Studio 编辑；JSON 适合程序生成。

## 从完整 YAML 开始

下载[三节点示例](https://iso-topology.mintlify.site/assets/first-diagram.yaml)，保存为 `input.yaml`：

```bash theme={null}
isotopo render input.yaml ./out
isotopo serve input.yaml
```

修改一个标签，确认图更新和源文件保存，再逐步增加复杂度。

## 选择布局

| 意图 | 写法 |
| - | - |
| 连线决定整体排布 | `layout: {mode: auto}` |
| 一排组件 | `layout: {mode: row, gap: 2}` |
| 网格面板 | `layout: {mode: grid, cols: 3}` |
| 核心与周边组件 | `layout: {mode: ring}`，第一个子项为核心 |
| 指定相对关系 | `place: {rightOf: api, gap: 2}` |

给 group 添加嵌套 parts 表达服务边界。先使用自动尺寸，避免固定容器容不下新增组件。间距以布局单元计算，不是屏幕像素。

## 连线与风格

使用稳定 ID 连接组件。`orthogonal` 沿等距轴布线；`orthogonal2` 可尝试避障。手动端口和途经点表达明确意图，也会限制自动修复。

主题统一默认颜色与文字；preset 复用重复组件风格。选择一个强调色和一个视觉核心，不要让每个节点都发光。长文字使用注释或屏幕方向标签。

## 检查后再发布

```bash theme={null}
isotopo validate input.yaml
isotopo evaluate input.yaml
isotopo repair input.yaml --compose --write
isotopo render --report input.yaml ./out
isotopo snapshot input.yaml ./out
```

逐步执行并检查结果。repair 会写回 YAML，应先备份。snapshot 需要外部光栅化工具；不可用时人工查看 SVG。检查关系、文字、连线、箭头和遮挡，评分不能证明业务架构正确。

SVG 用于支持矢量的文档；PNG 用于需要位图的场景。PDF 需要外部转换器。保存作者源码，以便下一次修改。

[格式参考（英文）](https://iso-topology.mintlify.site/guides/choose-format.md) · [布局指南（英文）](https://iso-topology.mintlify.site/guides/layout.md) · [主题参考（英文）](https://iso-topology.mintlify.site/reference/dsl-theme.md) · [导出指南（英文）](https://iso-topology.mintlify.site/getting-started/05-publishing.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.