Skip to content

Turn any idea, plan, or codebase into a beautiful interactive diagram. An agent skill for Claude Code, Codex, and more.

Accept leading-pipe rows and auto-width shorthand workflow nodes

tt-a1i92e3ac4d8ce4
diff --git a/archify/explainer/diagrams.mjs b/archify/explainer/diagrams.mjs
index d8b14f89..74e4031d 100644
--- a/archify/explainer/diagrams.mjs
+++ b/archify/explainer/diagrams.mjs
@@ -172,7 +172,7 @@ export function compileExplainerDiagram(diagramType, rows, { title, id, line = 1
} else {
if (placed.some(node => node.col > 5)) fail(context, 'diagram-shorthand-limit', 'Native workflow columns are limited to 0–5.', 'Use native workflow JSON with branches distributed across lanes.');
spec.lanes = Array.from({ length: Math.max(1, ...placed.map(node => node.row + 1)) }, (_, row) => ({ id: `lane-${row}`, label: row ? `分支 ${row}` : spec.meta.title }));
- spec.nodes = placed.map(({ row, ...node }) => ({ ...node, lane: `lane-${row}`, width: 168 }));
+ spec.nodes = placed.map(({ row, ...node }) => ({ ...node, lane: `lane-${row}` }));
spec.edges = edges;
}
} else if (diagramType === 'tree') {
diff --git a/archify/explainer/parse.mjs b/archify/explainer/parse.mjs
index cff22c11..60052eba 100644
--- a/archify/explainer/parse.mjs
+++ b/archify/explainer/parse.mjs
@@ -99,7 +99,8 @@ export function parseExplainer(sourceText, { inputPath, output } = {}) {
}
function cells(raw, line) {
const trimmed = raw.trim();
- const value = trimmed.startsWith('|') && trimmed.endsWith('|') ? trimmed.slice(1,-1) : trimmed;
+ let value = trimmed.startsWith('|') ? trimmed.slice(1) : trimmed;
+ if (value.endsWith('|') && !/(^|[^\\])(\\\\)*\\\|$/u.test(value)) value = value.slice(0,-1);
const result = []; let cell = '', code = false;
for (let i = 0; i < value.length; i++) {
const char = value[i];
diff --git a/archify/references/explainer-authoring.md b/archify/references/explainer-authoring.md
index 4b4b229d..4f865858 100644
--- a/archify/references/explainer-authoring.md
+++ b/archify/references/explainer-authoring.md
@@ -111,7 +111,7 @@ Actor rows: `actor <id> | label | type`. Message rows: `from | to | label | vari
| trace > fix | cause found | emphasis |
```
-Node rows: `id | label | type?`. Edge rows: `from > to | label? | variant?`. Workflows allow six columns from start to end; architecture allows twelve. Use `@architecture` for components that talk to each other and `@workflow` for steps a reader follows.
+Node rows: `id | label | type?`. Edge rows: `from > to | label? | variant?`. Nodes widen to fit their labels. Keep a workflow to five nodes along its longest path and edge labels to one or two words: a longer chain shrinks its text below the readable size; use `@steps` for long sequences. Architecture allows twelve columns. Use `@architecture` for components that talk to each other and `@workflow` for steps a reader follows.
**`@tree`**: one row per node, `id | label | parent`; the root's parent is `-`.
@@ -154,7 +154,7 @@ Other native types (`dataflow`, `lifecycle`, `class`, `waterfall`) and diagrams
| Directive | Header arguments | Rows |
| --- | --- | --- |
| `@answer` | `scope="..."` | none |
-| `@meta` | `locale`, `quality_profile`, `repo_url`, `repo_revision` | none |
+| `@meta` | `locale` (`en`, `zh-CN`, `zh-TW`, `es`, `ko`, `ar`), `quality_profile`, `repo_url`, `repo_revision` | none |
| `@source <id>` | `title`, `url`, or `path` with `lines=start:end` | none |
| `@steps` | `id` | `id | title | detail? | diagram-id? | node? | from~to? | edge-ids?` (node and route are exclusive) |
| `@callout` | `id`, `level=note|warning|open-question`, `title` | one cell per row; rows join into paragraphs |