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.

fix(verifiers): land treemap, heatmap and geometry fixes from seven PRs (#409)

Cathryn Laverybe2e736cd5e5
diff --git a/scripts/test-verify-geometry.py b/scripts/test-verify-geometry.py
index effeda7..635b1b4 100644
--- a/scripts/test-verify-geometry.py
+++ b/scripts/test-verify-geometry.py
@@ -135,6 +135,43 @@ def main() -> int:
check("translated contained badge remains legal", document(
'<g transform="translate(300 0)">' + badge + node + '</g>'), 0)
+ # Definitions are reusable geometry, not paint at their local coordinates.
+ mask = '<rect x="50" y="80" width="80" height="12" fill="#fff"/>'
+ prototype = '<rect x="100" y="70" width="100" height="60" fill="#eee" stroke="#000"/>'
+ check("unpainted reusable node cannot clip a mask", document(mask
+ + '<defs><g id="prototype">' + prototype + '</g></defs>'
+ + '<use href="#prototype" x="300"/>'), 0)
+ for container in ("symbol", "marker", "pattern", "clipPath", "mask"):
+ check(f"{container} definition is not a painted node", document(mask
+ + f'<{container} id="definition">' + prototype + f'</{container}>'), 0)
+ check("painted rectangle after definitions is still checked", document(mask
+ + '<defs><g id="prototype">' + prototype + '</g></defs>' + prototype), 1)
+ check("commented definition opening cannot hide painted nodes", document(mask
+ + '<!-- Reusable shapes can be placed under <defs>. -->' + prototype), 1)
+ check("commented definition close cannot expose prototypes", document(mask
+ + '<defs><!-- Close this section with </defs>. -->' + prototype + '</defs>'), 0)
+ check("commented definition wrapper cannot alter paint custody", document(mask
+ + '<!-- <defs><g>prototype</g></defs> -->' + prototype), 1)
+ check("ordinary painted group is still checked", document(mask + '<g>' + prototype + '</g>'), 1)
+ check("self-closing definitions do not hide following paint", document(mask + '<defs/>' + prototype), 1)
+ for quote in ('"', "'"):
+ for container in ("defs", "symbol", "marker", "pattern", "clipPath", "mask"):
+ quoted = f"<{container} data-note={quote}a > b{quote}/>"
+ check(f"quoted {container} self-close cannot hide following node ({quote})",
+ document(mask + quoted + prototype), 1)
+ check(f"quoted definition attribute keeps prototypes unpainted ({quote})",
+ document(mask + f"<defs data-note={quote}a > b{quote}>" + prototype + '</defs>'), 0)
+ check(f"quoted painted group preserves following connector ({quote})", document(
+ f"<g data-note={quote}a > b{quote}/>"
+ + '<path d="M 10 10 L 60 40" stroke="#000" marker-end="url(#arrow)"/>'), 1)
+ check("nested definition containers keep prototypes unpainted", document(mask
+ + '<defs><symbol id="prototype">' + prototype + '</symbol></defs>'), 0)
+ check("painted group after nested definitions is still checked", document(mask
+ + '<defs><symbol id="prototype">' + prototype + '</symbol></defs><g>'
+ + prototype + '</g>'), 1)
+ check("connector prototypes are not painted arrows", document(
+ '<defs><path d="M 10 10 L 60 40" stroke="#000" marker-end="url(#arrow)"/></defs>'), 0)
+
# A long mono plate (128px, as shipped in example-sequence-oauth.html) or a
# wide CJK label plate must be recognized as a mask and checked like any other.
check(
diff --git a/scripts/test-verify-heatmap.py b/scripts/test-verify-heatmap.py
index 3e46e1a..9c5b3fd 100644
--- a/scripts/test-verify-heatmap.py
+++ b/scripts/test-verify-heatmap.py
@@ -139,6 +139,46 @@ def main() -> int:
if code != 0:
failures.append(f"{label}: shipped example failed:\n {output.strip()}")
+ single_quoted = re.sub(
+ r'="([^"<>]*)"',
+ lambda match: "='" + match.group(1).replace("'", "&#39;") + "'",
+ original,
+ )
+ case(failures, d, "P-single-quotes.html", single_quoted, original, True,
+ "single-quoted attributes retain the same heatmap semantics")
+ mixed_quotes = original.replace(
+ FIRST_NONFOCAL,
+ FIRST_NONFOCAL.replace('fill="', 'data-note="fill=\'red\'" fill="', 1),
+ )
+ case(failures, d, "P-mixed-quotes.html", mixed_quotes, original, True,
+ "attribute-like metadata does not override the real fill")
+ mixed_single = single_quoted.replace(
+ "fill='rgba(45,49,66,0.29)'",
+ "data-note='fill=\"red\"' fill='rgba(45,49,66,0.29)'",
+ 1,
+ )
+ case(failures, d, "P-mixed-single-quotes.html", mixed_single, single_quoted, True,
+ "double-quoted text inside metadata does not override a single-quoted fill")
+
+ commented_transform = original.replace('</style>', '/* archived experiment\n transform: translateX(12px);\n */\n</style>', 1)
+ case(failures, d, "P-commented-transform.html", commented_transform, original, True,
+ "a CSS comment cannot move verified geometry")
+
+ archived_style = original.replace('</style>', '</style><!-- <style>rect { transform: translateX(12px); }</style> -->', 1)
+ case(failures, d, "P-archived-style.html", archived_style, original, True,
+ "an HTML comment cannot activate archived CSS")
+ live_transform = original.replace('</style>', 'rect {/**/transform: translateX(12px); }\n</style>', 1)
+ case(failures, d, "N-comment-prefixed-transform.html", live_transform, original, False,
+ "a CSS comment before a property cannot hide an active transform")
+ for name, css in (
+ ("legacy-html-markers", "<!-- rect { transform: translateX(12px); } -->"),
+ ("quoted-comment-opener", 'rect { --note: "/*"; transform: translateX(12px); /* note */ }'),
+ ("escaped-quote-comment-opener", r'rect { --note: "\"/*"; transform: translateX(12px); /* note */ }'),
+ ):
+ live_css = original.replace('</style>', css + '\n</style>', 1)
+ case(failures, d, f"N-{name}.html", live_css, original, False,
+ "quoted comment markers and HTML legacy markers cannot hide active CSS")
+
# ── Negative: mutations that must be rejected ─────────────────────────
# N1: two focal cells
@@ -400,6 +440,14 @@ def main() -> int:
failures.append(f"alpha foreground {theme}/{alpha} unexpected result: {output.strip()}")
print("OK: translucent AA foregrounds pass; weak-alpha text still fails in both themes")
+ with tempfile.TemporaryDirectory() as tmp:
+ encoded = re.sub(r'(\b(?:x|y|width|height|data-value|data-share)="[^"<>]*)[0-9]',
+ lambda match: match.group(0)[:-1] + f"&#{ord(match.group(0)[-1])};",
+ GOOD.read_text(encoding="utf-8"))
+ code, output = run(write(Path(tmp), "encoded-attributes.html", encoded))
+ if code != 0:
+ failures.append(f"XML-encoded numeric attributes rejected: {output.strip()}")
+
if failures:
for f in failures:
print("FAIL:", f, file=sys.stderr)
diff --git a/scripts/test-verify-treemap.py b/scripts/test-verify-treemap.py
index 4b531d6..d0aca2f 100644
--- a/scripts/test-verify-treemap.py
+++ b/scripts/test-verify-treemap.py
@@ -99,6 +99,61 @@ def main() -> int:
with tempfile.TemporaryDirectory() as raw:
directory = Path(raw)
+ archived = re.sub(r'<rect\b[^>]*>',
+ lambda match: "<!-- " + match.group(0) + " -->", source)
+ code, output = run(write(directory, "archived-cells.html", archived))
+ if code == 0 or "parseable treemap cells" not in output:
+ failures.append("commented-out data-share cells were treated as drawn geometry")
+
+ unfinished = "<!--\n" + re.sub(r"<!--.*?-->", "", source, flags=re.DOTALL)
+ code, output = run(write(directory, "unfinished-comment.html", unfinished))
+ if code == 0 or "parseable treemap cells" not in output:
+ failures.append("an unfinished HTML comment left hidden treemap cells available")
+
+ inline_comment = source.replace(
+ ">South America</text>", ">South<!--" + "\n" * 30 + "--> America</text>",
+ )
+ code, output = run(write(directory, "inline-comment.html", inline_comment))
+ if inline_comment == source or code != 0:
+ failures.append(f"inline comment newlines changed label geometry: {output.strip()}")
+
+ def single_quotes(text: str) -> str:
+ return re.sub(
+ r'="([^"<>]*)"',
+ lambda match: match.group(0) if "'" in match.group(1) else "='" + match.group(1) + "'",
+ text,
+ )
+
+ quoted = single_quotes(source)
+ code, output = run(write(directory, "single-quotes.html", quoted))
+ if code != 0:
+ failures.append(f"single-quoted equivalent treemap was rejected: {output}")
+
+ valid_px = source.replace('font-size="14"', 'font-size="14px"', 1)
+ if valid_px == source:
+ failures.append("could not build the valid-px-font fixture (anchor moved)")
+ else:
+ code, output = run(write(directory, "valid-px-font.html", valid_px))
+ if code != 0:
+ failures.append(f"valid px font-size regressed the existing conservative behavior: {output}")
+ # An unsupported length on one field must not hide a non-finite
+ # value on another field of the same label.
+ mixed = re.sub(r'(<text\b[^>]*?\bx=)"[^"]*"([^>]*font-size="14px")',
+ lambda match: match.group(1) + '"inf"' + match.group(2), valid_px, count=1)
+ if mixed == valid_px:
+ failures.append("could not build the mixed px/inf fixture (anchor moved)")
+ else:
+ code, output = run(write(directory, "mixed-px-inf.html", mixed))
+ if code == 0 or "finite label geometry" not in output:
+ failures.append(f"non-finite x beside a px font-size escaped the containment check: {output}")
+
+ for field, value in (("font-size", "nan"), ("x", "inf"), ("y", "-inf"), ("font-size", "0"), ("font-size", "-1")):
+ malformed = re.sub(r'(<text\b[^>]*\b' + field + r'=)"[^"]*"',
+ lambda match: match.group(1) + '"' + value + '"', source, count=1)
+ code, output = run(write(directory, f"nonfinite-{field}.html", malformed))
+ if code == 0 or "finite label geometry" not in output:
+ failures.append(f"non-finite text {field} escaped the containment check: {output}")
+
# 1. Every shipped Latin example must pass untouched, proving the
# Unicode estimator did not move the calibrated Latin baseline.
shipped_clean = True
@@ -161,6 +216,16 @@ def main() -> int:
else:
print("OK: a label wider than its cell is rejected")
+ shifted = "<!--" + "\n" * 30 + "-->\n" + overflowing
+ label_match = re.search(r"<text\b[^>]*>South America and the Caribbean Basin</text>", shifted)
+ if label_match is None:
+ failures.append("could not locate the shifted overflowing label (anchor moved)")
+ else:
+ line = shifted.count("\n", 0, label_match.start()) + 1
+ code, output = run(write(directory, "shifted-label.html", shifted))
+ if code == 0 or f"shifted-label.html:{line}: label" not in output:
+ failures.append(f"comment removal changed diagnostic line tracking: {output.strip()}")
+
# 4a. Reproduce #115: most glyphs in this Korean translation are
# full-width. The old 0.60em character-count estimate called it
# 122.4px wide and accepted it in 132px of available space, while
@@ -258,6 +323,16 @@ def main() -> int:
else:
print("OK: an information mark overflowing its cell is rejected")
+ for name, fixture, diagnostic in (
+ ("label", overflowing, "label 'South America and the Caribbean Basin'"),
+ ("marker", marker_over, "information marker"),
+ ):
+ code, output = run(write(directory, f"single-quoted-{name}-overflow.html", single_quotes(fixture)))
+ if code == 0 or diagnostic not in output:
+ failures.append(f"single-quoted {name} overflow lost its finding: {output.strip()}")
+ else:
+ print(f"OK: single-quoted {name} overflow retains its finding")
+
# 4f. Combining marks do not advance independently. Eighteen decomposed
# accented glyphs fit by the unchanged Latin baseline (129.6px in
# 132px), but counting every acute accent as a character would
@@ -541,6 +616,30 @@ def main() -> int:
else:
print(f"OK: {label} data-share geometry fails closed")
+ with tempfile.TemporaryDirectory() as tmp:
+ encoded = re.sub(r'(\b(?:x|y|width|height|cx|cy|r|data-value|data-share)="[^"<>]*)[0-9]',
+ lambda match: match.group(0)[:-1] + f"&#{ord(match.group(0)[-1])};",
+ GOOD.read_text(encoding="utf-8"))
+ code, output = run(write(Path(tmp), "encoded-attributes.html", encoded))
+ if code != 0:
+ failures.append(f"XML-encoded numeric attributes rejected: {output.strip()}")
+
+ encoded_marker_over = re.sub(
+ r'(\b(?:cx|cy|r)="[^"<>]*)[0-9]',
+ lambda match: match.group(0)[:-1] + f"&#{ord(match.group(0)[-1])};",
+ marker_over,
+ )
+ if encoded_marker_over == marker_over:
+ failures.append("could not encode the overflowing-marker fixture (anchor moved)")
+ else:
+ code, output = run(write(Path(tmp), "encoded-marker-overflow.html", encoded_marker_over))
+ if code == 0:
+ failures.append("XML-encoded information mark overflowing its cell was accepted")
+ elif "information marker" not in output:
+ failures.append(f"encoded marker overflow lacked a marker finding: {output.strip()}")
+ else:
+ print("OK: XML-encoded cx/cy/r retain marker containment checks")
+
for failure in failures:
print(f"FAIL: {failure}")
if failures:
diff --git a/scripts/verify-geometry.py b/scripts/verify-geometry.py
index 2bcab5e..20e6550 100644
--- a/scripts/verify-geometry.py
+++ b/scripts/verify-geometry.py
@@ -123,7 +123,7 @@ def contained(inner: Rect, outer: Rect) -> bool:
TAG_RE = re.compile(
- r"<(?P<close>/?)(?P<tag>g|svg|rect|path|line)\b(?P<attrs>[^>]*?)(?P<empty>/?)>",
+ r"<!--[\s\S]*?-->|<(?P<close>/?)(?P<tag>g|svg|defs|symbol|marker|pattern|clipPath|mask|rect|path|line)\b(?P<attrs>(?:\"[^\"]*\"|'[^']*'|[^'\">])*?)(?P<empty>/?)>",
re.IGNORECASE,
)
TRANSLATE_RE = re.compile(
@@ -306,6 +306,7 @@ def path_segments(d: str) -> list[Segment] | None:
Offset = tuple[float, float]
+DEFINITION_TAGS = {"defs", "symbol", "marker", "pattern", "clippath", "mask"}
def translation(attrs: str) -> Offset | None:
@@ -326,19 +327,28 @@ def shapes(source: str):
Offsets accumulate `translate()` on enclosing groups, so panels drawn with
the same local coordinates (architecture delta snapshots) are compared in
canvas space. Under any other transform, or inside a nested `<svg>` icon,
- the offset is None and the element is left out of connector checks.
+ the offset is None and the element is left out of connector checks. Shapes
+ inside definition-only containers do not paint at their source coordinates
+ and are also left out; this does not resolve referenced <use> instances.
"""
stack: list[Offset | None] = []
+ containers: list[str] = []
for match in TAG_RE.finditer(source):
+ if match.group("tag") is None: # Inert comments cannot change paint custody.
+ continue
tag, attrs = match.group("tag").lower(), match.group("attrs")
- if tag in {"g", "svg"}:
+ if tag in {"g", "svg"} or tag in DEFINITION_TAGS:
if match.group("close"):
if stack:
stack.pop()
+ containers.pop()
elif not match.group("empty"):
nested_svg = tag == "svg" and bool(stack)
stack.append(None if nested_svg else translation(attrs))
+ containers.append(tag)
+ continue
+ if any(container in DEFINITION_TAGS for container in containers):
continue
frame: Offset | None = (0.0, 0.0)
for step in stack + [translation(attrs)]:
diff --git a/scripts/verify-heatmap.py b/scripts/verify-heatmap.py
index e6f46a7..c7f16ae 100644
--- a/scripts/verify-heatmap.py
+++ b/scripts/verify-heatmap.py
@@ -51,6 +51,7 @@ from __future__ import annotations
import argparse
import math
import re
+import html
import sys
from pathlib import Path
@@ -61,6 +62,13 @@ RECT_RE = re.compile(r"<rect\b(?P<attrs>[^>]*?)/?>", re.IGNORECASE)
TEXT_RE = re.compile(r"<text\b(?P<attrs>[^>]*)>", re.IGNORECASE)
COMMENT_RE = re.compile(r"<!--.*?-->", re.DOTALL)
STYLE_RE = re.compile(r"<style\b[^>]*>(?P<body>.*?)</style>", re.IGNORECASE | re.DOTALL)
+COMMENT_OR_STYLE_RE = re.compile(
+ r"<!--.*?(?:-->|$)|" + STYLE_RE.pattern, re.IGNORECASE | re.DOTALL
+)
+CSS_NONCODE_RE = re.compile(
+ r'''"(?:\\[\s\S]|[^"\\])*"|'(?:\\[\s\S]|[^'\\])*'|\\[\s\S]|/\*.*?(?:\*/|$)''',
+ re.DOTALL,
+)
RGBA_RE = re.compile(r"rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*([\d.]+)\s*\)")
HEX_RE = re.compile(r"^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$")
@@ -105,8 +113,14 @@ def _length_px(raw: str | None, field: str, errors: list[str] | None) -> float |
def _attr(attrs_str: str, name: str) -> str | None:
- m = re.search(r"\b" + re.escape(name) + r'\s*=\s*"([^"]*)"', attrs_str)
- return m.group(1) if m else None
+ for match in re.finditer(
+ r"""(?P<name>[\w:-]+)\s*=\s*(?P<quote>["'])(?P<value>.*?)(?P=quote)""",
+ attrs_str,
+ re.DOTALL,
+ ):
+ if match.group("name") == name:
+ return html.unescape(match.group("value"))
+ return None
def _is_accent(r: int, g: int, b: int) -> bool:
@@ -329,9 +343,18 @@ def check_file(path: Path) -> list[str]:
except OSError as exc:
return [f"{path.name}: cannot read: {exc}"]
+ # Consume archived HTML comments before styles, while keeping HTML legacy
+ # comment markers inside a live style's raw text available to the CSS guard.
+ styles = [match.group("body") for match in COMMENT_OR_STYLE_RE.finditer(source)
+ if match.group("body") is not None]
+ source = COMMENT_RE.sub("", source)
+
# CSS-moves-geometry check.
- for style_body in STYLE_RE.findall(source):
- m = CSS_MOVES_MARK_RE.search(style_body)
+ for style_body in styles:
+ # Strings/escapes are indivisible: a quoted /* cannot begin a comment
+ # that swallows the following active geometry declaration.
+ live_css = CSS_NONCODE_RE.sub(" ", style_body)
+ m = CSS_MOVES_MARK_RE.search(live_css)
if m:
errors.append(
f"{path.name}: CSS property '{m.group('prop')}' can move verified "
diff --git a/scripts/verify-treemap.py b/scripts/verify-treemap.py
index 65a4cee..6e10d0e 100644
--- a/scripts/verify-treemap.py
+++ b/scripts/verify-treemap.py
@@ -50,7 +50,7 @@ ASSET_DIR = ROOT / "skills/diagram-design/assets"
CELL_RE = re.compile(r"<rect\b(?P<attrs>[^>]*)/?>", re.IGNORECASE)
TEXT_RE = re.compile(r"<text\b(?P<attrs>[^>]*)>(?P<body>.*?)</text>", re.IGNORECASE | re.DOTALL)
CIRCLE_RE = re.compile(r"<circle\b(?P<attrs>[^>]*)/?>", re.IGNORECASE)
-ATTR_RE = re.compile(r'(?P<name>[\w:-]+)="(?P<value>[^"]*)"')
+ATTR_RE = re.compile(r'''(?P<name>[\w:-]+)\s*=\s*(?P<quote>["'])(?P<value>.*?)(?P=quote)''', re.DOTALL)
ROTATE_RE = re.compile(r"rotate\(\s*(?P<deg>-?[\d.]+)")
TAG_RE = re.compile(r"<[^>]+>")
# A cell states its size one of two ways, and the two must not be confused: a
@@ -155,7 +155,7 @@ def parse_cells(source: str, findings: list[str] | None = None) -> list[Box]:
"""
seen: list[Box] = []
for m in CELL_RE.finditer(source):
- attrs = {a.group("name"): a.group("value") for a in ATTR_RE.finditer(m.group("attrs"))}
+ attrs = {a.group("name"): html.unescape(a.group("value")) for a in ATTR_RE.finditer(m.group("attrs"))}
has_share_metadata = "data-share" in attrs
if attrs.get("rx") != "2" and not has_share_metadata:
continue
@@ -294,6 +294,14 @@ def parse_claim(text: str) -> tuple[float | None, float | None]:
def check(path: Path) -> list[str]:
source = path.read_text(encoding="utf-8")
+ # Keep diagnostic line numbers in comment placeholders; plain() removes
+ # the whole placeholder so archived newlines never become label glyphs.
+ source = re.sub(
+ r"<!--.*?(?:-->|$)",
+ lambda match: "<!--" + "\n" * match.group(0).count("\n") + "-->",
+ source,
+ flags=re.DOTALL,
+ )
findings: list[str] = []
parse_findings: list[str] = []
cells = parse_cells(source, parse_findings)
@@ -308,7 +316,26 @@ def check(path: Path) -> list[str]:
labels: dict[int, list[str]] = {index: [] for index in range(len(cells))}
for m in TEXT_RE.finditer(source):
- attrs = {a.group("name"): a.group("value") for a in ATTR_RE.finditer(m.group("attrs"))}
+ attrs = {a.group("name"): html.unescape(a.group("value")) for a in ATTR_RE.finditer(m.group("attrs"))}
+ geometry = {key: attrs[key] for key in ("x", "y") if key in attrs}
+ geometry["font-size"] = attrs.get("font-size", "12")
+ parsed = {}
+ for key, raw in geometry.items():
+ try:
+ parsed[key] = float(raw)
+ except ValueError:
+ parsed[key] = None
+ # Judge every field that parses before skipping one that does not, so
+ # an unsupported length on one field cannot hide an invalid number on
+ # another.
+ font_size = parsed["font-size"]
+ if (any(value is not None and not math.isfinite(value) for value in parsed.values())
+ or (font_size is not None and font_size <= 0)):
+ findings.append(f"{path.name}:{line_of(source, m.start())}: expected finite label geometry and a positive font-size")
+ continue
+ if None in parsed.values():
+ # Preserve the existing conservative skip for unsupported SVG length formats.
+ continue
box = label_box(attrs, m.group("body"))
if box is None:
continue
@@ -350,7 +377,7 @@ def check(path: Path) -> list[str]:
# one-letter text can fit while the surrounding disc still crosses a cell
# boundary, so circles need their own containment check.
for m in CIRCLE_RE.finditer(source):
- attrs = {a.group("name"): a.group("value") for a in ATTR_RE.finditer(m.group("attrs"))}
+ attrs = {a.group("name"): html.unescape(a.group("value")) for a in ATTR_RE.finditer(m.group("attrs"))}
try:
cx = float(attrs["cx"])
cy = float(attrs["cy"])
diff --git a/skills/diagram-design/references/primitives-core.md b/skills/diagram-design/references/primitives-core.md
index cc9b0db..fdfd638 100644
--- a/skills/diagram-design/references/primitives-core.md
+++ b/skills/diagram-design/references/primitives-core.md
@@ -51,6 +51,8 @@ Don't use the dot pattern when the diagram sits inside a product page, slide, or
**Draw arrows before boxes** so z-order puts lines behind nodes.
+The geometry source gate excludes shapes inside definition-only containers (`defs`, `symbol`, `marker`, `pattern`, `clipPath`, `mask`) because those shapes do not paint at their local coordinates. It does not resolve `<use>` instances; check referenced drawings with rendered lint and visual review. Inert HTML comments and `>` inside quoted tag attributes do not alter definition custody.
+
## Mandatory connector rules
These six rules are **non-negotiable**. Run the pre-output checklist (SKILL.md §9) to verify before producing any diagram.
diff --git a/skills/diagram-design/references/type-heatmap.md b/skills/diagram-design/references/type-heatmap.md
index 50a5ce2..bdd3272 100644
--- a/skills/diagram-design/references/type-heatmap.md
+++ b/skills/diagram-design/references/type-heatmap.md
@@ -2,6 +2,8 @@
**Best for:** cross-tabulated data where *which row × column combination stands out* is the story. Use when the reader needs to scan a full matrix at once — not compare individual bars or trace a trend line — and one cell (or a cluster of cells) is editorially distinct from the field. Common uses: CI failure rate by service and sprint, support ticket volume by team and week, confusion matrix for a classifier, correlation coefficients across many variables.
+The CSS geometry guard ignores comments; active transform declarations still fail.
+
## Layout conventions
- **Plot area:** left 160px (row labels), top 64px (column labels), right 40px, bottom 120px (legend area); inside `0 0 1000 500` viewBox.
@@ -58,6 +60,8 @@ Every cell is two overlapping `<rect>` elements: a paper-fill underlay (no data
## Declaring the values
+The verifier accepts either matching quote delimiter for SVG attributes.
+
**Every drawn cell is bound to its row, column, and value.** Declared data values are finite and nonnegative; unsigned counts may exceed one billion. NaN, infinity, and negative values are rejected rather than weakening grid completeness. The paper underlay carries nothing. The data rect carries all three.
| Binding | Without it |
diff --git a/skills/diagram-design/references/type-treemap.md b/skills/diagram-design/references/type-treemap.md
index 0739f14..a947125 100644
--- a/skills/diagram-design/references/type-treemap.md
+++ b/skills/diagram-design/references/type-treemap.md
@@ -21,6 +21,12 @@ Not for: ranked lists where exact values matter more than proportion (use a **ba
- **Contrast:** compute the ceiling against the token you actually ship. The 9px value line is `muted`, not `ink`, and `muted` needs a lighter cell than `ink` does: measured against the composited fill, the top of the ramp can go to **0.16 on light paper and 0.14 on dark** before it drops under 4.5:1. (`ink` would tolerate 0.20 — which is exactly the number you will write down if you check the wrong token.) A mid-tone fill — solid accent, or 50% ink — fails against both light and dark text; use the tint-plus-stroke pattern instead. The source line takes `muted` too: `soft` measures 3.48:1 on paper and never reaches AA anywhere on this ramp.
- **Legend:** the house block (rule, `LEGEND`, keys), naming the focal cell, the direction of the ink ramp, and any cell carrying an info mark. **Name that direction by contrast against the paper — `stronger contrast is larger` — never by lightness.** `darker is larger` is true only on light paper; ship it in the dark variant and the legend states the opposite of what the reader sees, because the ramp's lightness inverts with the skin while its opacity does not. Named by contrast, one sentence serves all three variants and cannot rot apart. `scripts/verify-skin-polarity.py` gates this, checking every directional tone claim against the ramp composited on that file's own paper. HTML comments are not visible legend copy, including comments between text fragments; contradictory or unverifiable visible wording still fails. Explicit `fill-opacity` and `opacity` presentation attributes multiply the fill color's alpha before that comparison; CSS rules and inherited/group opacity are not resolved by this source checker. Ranked cells with zero effective opacity remain in the comparison at paper contrast. The source line rides the same row as `LEGEND`, right-aligned in mono 8px, stating what area encodes plus the dataset and its date. Archived closing tags inside an inline comment cannot truncate the surrounding visible claim.
+Commented-out SVG geometry does not contribute to verified cell area or annotation containment.
+
+Both matching SVG attribute quote delimiters are supported by the geometry verifier.
+
+Parseable numeric label positions and font sizes must be finite, and font sizes must be positive, so invalid annotations cannot bypass containment comparisons. Unsupported SVG length formats retain the existing conservative skip; they are not certified by this source checker.
+
### Declaring the share
**Every cell carries `data-share` — including cells too small to label.** It is the cell's percentage of the whole, and it is what makes the area checkable: