Skip to content

Editorial diagram design for Claude Code, Codex, GitHub Copilot, Cursor, Factory Droid, Qoder, and Pi. 45 diagram types. Self-contained HTML + SVG. No shadows. No Mermaid slop.

docs: fix export defaults and the label mask colour (#480)

Cathryn Laveryd0e57dc943ce
diff --git a/commands/export-diagram.md b/commands/export-diagram.md
index 2fe7404..ddda05a 100644
--- a/commands/export-diagram.md
+++ b/commands/export-diagram.md
@@ -15,7 +15,7 @@ Full argument string: `$ARGUMENTS`
## Defaults
-- **With no format flags, or with `--svg-only`/`--png-only`/`--scale`/`--output` but no `--registry`:** produce **both** `.svg` and `.png` next to the source (e.g. `diagram.html` → `diagram.svg` + `diagram.png`).
+- **With no format flag (nothing, or only `--scale`/`--output`) and no `--registry`:** produce **both** `.svg` and `.png` next to the source (e.g. `diagram.html` → `diagram.svg` + `diagram.png`). `--svg-only` or `--png-only` restricts the image output to that one format.
- PNG renders at `device_scale_factor=2`.
- **`--registry` given by itself, with neither `--svg-only` nor `--png-only` also present, produces *only* the registry JSON.** The SVG/PNG defaults above do not also apply, and Playwright is never required for a registry-only call. To get an image alongside the registry, add `--svg-only` or `--png-only` explicitly.
diff --git a/prompts/export-diagram.md b/prompts/export-diagram.md
index 51fa9c6..9c8b178 100644
--- a/prompts/export-diagram.md
+++ b/prompts/export-diagram.md
@@ -9,7 +9,7 @@ Full argument string: `$ARGUMENTS`
## Defaults
-- With no format flags, or with `--svg-only`/`--png-only`/`--scale`/`--output` but no `--registry`: produce both `.svg` and `.png` next to source (for example, `diagram.html` → `diagram.svg` + `diagram.png`).
+- With no format flag (nothing, or only `--scale`/`--output`) and no `--registry`: produce both `.svg` and `.png` next to source (for example, `diagram.html` → `diagram.svg` + `diagram.png`). `--svg-only` or `--png-only` restricts image output to that one format.
- Render PNG at `device_scale_factor=2`.
- `--registry` given alone, with neither `--svg-only` nor `--png-only` also present, produces only the registry JSON — the SVG/PNG defaults above do not apply, and Playwright is never required. Add `--svg-only` or `--png-only` explicitly to also get an image.
diff --git a/scripts/test-verify-docs-sync.py b/scripts/test-verify-docs-sync.py
index e2c5fcc..a738864 100644
--- a/scripts/test-verify-docs-sync.py
+++ b/scripts/test-verify-docs-sync.py
@@ -604,6 +604,42 @@ def check_export_surface_parity(verify) -> None:
(ROOT / "prompts/export-diagram.md").read_text(encoding="utf-8"),
encoding="utf-8",
)
+ # #474: the produce-both Defaults bullet once listed the single-format flags.
+ for fake, name in ((fake_cmd, "commands"), (fake_prompt, "prompts")):
+ shipped = fake.read_text(encoding="utf-8")
+ fake.write_text(
+ shipped.replace(
+ "only `--scale`/`--output`",
+ "`--svg-only`/`--png-only`/`--scale`/`--output`",
+ ),
+ encoding="utf-8",
+ )
+ errors = []
+ verify.check_export_surface_parity(errors, fake_root)
+ expected = (
+ f"{name}/export-diagram.md Defaults lists --svg-only, --png-only among "
+ "the cases that produce both .svg and .png; each restricts output to "
+ "its one format"
+ )
+ if errors != [expected]:
+ raise AssertionError(f"{name} single-format flags in Defaults not caught: {errors}")
+ print(f"OK export surface parity: {name} Defaults listing --svg-only caught")
+
+ fake.write_text(
+ re.sub(r"^- .*produce\W+both.*\n", "", shipped, flags=re.MULTILINE | re.IGNORECASE),
+ encoding="utf-8",
+ )
+ errors = []
+ verify.check_export_surface_parity(errors, fake_root)
+ expected = (
+ f"{name}/export-diagram.md Defaults has no bullet saying when both "
+ ".svg and .png are produced"
+ )
+ if errors != [expected]:
+ raise AssertionError(f"{name} missing produce-both bullet not caught: {errors}")
+ print(f"OK export surface parity: {name} missing produce-both bullet caught")
+ fake.write_text(shipped, encoding="utf-8")
+
fake_cmd.unlink()
errors = []
verify.check_export_surface_parity(errors, fake_root)
diff --git a/scripts/verify-docs-sync.py b/scripts/verify-docs-sync.py
index a746f41..793d3c9 100644
--- a/scripts/verify-docs-sync.py
+++ b/scripts/verify-docs-sync.py
@@ -1752,8 +1752,34 @@ def check_title_fallback_order(errors: list[str], root: Path) -> None:
)
+EXPORT_DEFAULTS = re.compile(r"^## Defaults\n(.*?)(?=^## |\Z)", re.MULTILINE | re.DOTALL)
+PRODUCE_BOTH = re.compile(r"produce\s+\**both\b", re.IGNORECASE)
+
+
+def export_defaults_error(name: str, text: str) -> str | None:
+ """Why an export surface's produce-both Defaults bullet is wrong, or None."""
+ section = EXPORT_DEFAULTS.search(text)
+ bullets = re.findall(r"^- (.*)$", section.group(1), re.MULTILINE) if section else []
+ for bullet in bullets:
+ match = PRODUCE_BOTH.search(bullet)
+ if not match:
+ continue
+ flags = [flag for flag in ("--svg-only", "--png-only") if flag in bullet[: match.start()]]
+ if flags:
+ return (
+ f"{name} Defaults lists {', '.join(flags)} among the cases that produce "
+ "both .svg and .png; each restricts output to its one format"
+ )
+ return None
+ return f"{name} Defaults has no bullet saying when both .svg and .png are produced"
+
+
def check_export_surface_parity(errors: list[str], root: Path) -> None:
- """commands/export-diagram.md and prompts/export-diagram.md must both carry the mutual-exclusion rule."""
+ """commands/export-diagram.md and prompts/export-diagram.md must both carry the mutual-exclusion rule.
+
+ Neither may list `--svg-only` or `--png-only` among the cases its Defaults
+ says produce both formats, since each flag emits only its own format (#474).
+ """
command_path = root / "commands/export-diagram.md"
prompt_path = root / "prompts/export-diagram.md"
if not command_path.is_file():
@@ -1773,6 +1799,13 @@ def check_export_surface_parity(errors: list[str], root: Path) -> None:
errors.append(
"prompts/export-diagram.md missing `--svg-only` and `--png-only` mutual-exclusion rule"
)
+ for name, text in (
+ ("commands/export-diagram.md", command_text),
+ ("prompts/export-diagram.md", prompt_text),
+ ):
+ problem = export_defaults_error(name, text)
+ if problem:
+ errors.append(problem)
def main() -> int:
diff --git a/skills/diagram-design/SKILL.md b/skills/diagram-design/SKILL.md
index e616298..2b8fc64 100644
--- a/skills/diagram-design/SKILL.md
+++ b/skills/diagram-design/SKILL.md
@@ -291,7 +291,7 @@ Run before producing any diagram.
- [ ] **§6 rule 4:** a distinct attach point per connector on a shared edge, 12px or more apart, none hiding another?
- [ ] **§6 rule 5:** no transit behind a non-endpoint box, except the unavoidable case (dashed, label at the visible end)?
- [ ] **§6 rule 6:** no label mask overlapping a node drawn after it? (From a repository checkout, run `python3 <repo-root>/scripts/verify-geometry.py <file>`.)
-- [ ] Every arrow label has an opaque `fill="#f5f5f5"` rect behind it?
+- [ ] Every arrow label has an opaque `fill="{paper}"` rect behind it?
- [ ] Legend is a horizontal bottom strip, not floating?
- [ ] No vertical `writing-mode` text?
- [ ] `viewBox` expanded for the legend strip (~60px)?