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.
fix(mermaid-import): list else/and/option regions in the digest (#466)
bercef8d14c7c21b7
diff --git a/scripts/verify-mermaid-import.py b/scripts/verify-mermaid-import.pyindex 464b291..1fbce7e 100644--- a/scripts/verify-mermaid-import.py+++ b/scripts/verify-mermaid-import.py@@ -980,6 +980,26 @@ def check_sequence_highlight_nesting_regression(tmp: Path) -> None:ok("sequence highlight blocks preserve semantic fragment regions and depth")+def check_sequence_digest_regions(tmp: Path) -> None:+ scene = tmp / "sequence-digest-regions.mmd"+ scene.write_text(+ "sequenceDiagram\nparticipant A\nparticipant B\n"+ "alt valid file\nA->>B: ok\nelse too large\nA->>B: 413\nelse too<br>slow\nA->>B: 504\n"+ "else\nA->>B: other\nend\n"+ "par one\nA->>B: x\nand two\nA->>B: y\nend\n"+ "critical connect\nA->>B: c\noption timeout\nA->>B: t\nend\n",+ encoding="utf-8",+ )+ expected = (+ "- fragments: alt(valid file | else: too large | else: too ⏎ slow | else: unlabeled), "+ "par(one | and: two), "+ "critical(connect | option: timeout)"+ )+ if expected not in run_extract([str(scene)]).splitlines():+ fail("digest drops the else/and/option regions of sequence fragments")+ ok("digest lists the else/and/option regions of sequence fragments")++def check_sequence_grammar_forms(tmp: Path) -> None:"""Quoted participants, create directives, and full arrow vocabulary.@@ -1491,6 +1511,7 @@ def main() -> int:check_legacy_stdout_encoding(tmp)check_sequence_grammar_forms(tmp)check_sequence_highlight_nesting_regression(tmp)+ check_sequence_digest_regions(tmp)check_adversarial(tmp)check_errors_and_limits(tmp)check_docs_and_wiring()diff --git a/skills/diagram-design/scripts/mermaid_extract.py b/skills/diagram-design/scripts/mermaid_extract.pyindex 2caf26d..f2fb24d 100644--- a/skills/diagram-design/scripts/mermaid_extract.py+++ b/skills/diagram-design/scripts/mermaid_extract.py@@ -1322,6 +1322,16 @@ def _block_summary(block: SourceBlock, selected: list[Diagram]) -> str:return f"[{diagram.index}] {diagram.kind} ({len(diagram.nodes)}n/{len(diagram.edges)}e)"+# The keyword that opens each extra region of a fragment: `else` in alt, `and` in par, `option` in critical.+REGION_KEYWORDS = {"alt": "else", "par": "and", "critical": "option"}+++def _fragment_digest(item: dict[str, Any]) -> str:+ keyword = REGION_KEYWORDS.get(item["kind"], "else")+ parts = [item["label"] or "unlabeled"] + [f"{keyword}: {region or 'unlabeled'}" for region in item["regions"]]+ return " | ".join(_escape_table(part) for part in parts)++def digest(path: Path,blocks: list[SourceBlock],@@ -1358,8 +1368,7 @@ def digest()if diagram.fragments:fragments = ", ".join(- f"{item['kind']}({_escape_markdown(item['label'] or 'unlabeled')})"- for item in diagram.fragments+ f"{item['kind']}({_fragment_digest(item)})" for item in diagram.fragments)output.append(f"- fragments: {fragments}")if diagram.notes: