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(style-guide): Cyrillic labels — Noto Serif title fallback (#221)

Rosen Velikovb26918f56ecd
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 22e2a69..c0646e3 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -52,7 +52,7 @@ Every validation gate below must pass before a PR is ready. They also run automa
| Doctor diagnostics contract (env checks, script presence, routing wiring) | `python3 scripts/verify-doctor.py` |
| Doctor diagnostics adversarial tests | `python3 scripts/test-verify-doctor.py` |
| Every shipped motion template/example | `python3 scripts/verify-motion.py --shipped` |
-| Docs/routing sync (description hooks, gallery, README tree, reference links, strict-bundler support paths, command/prompt surfaces) | `python3 scripts/verify-docs-sync.py && python3 scripts/test-verify-docs-sync.py` |
+| Docs/routing sync (description hooks, gallery, README tree, reference links and style-guide anchors, strict-bundler support paths, command/prompt surfaces, font-link parity, template title fallback order) | `python3 scripts/verify-docs-sync.py && python3 scripts/test-verify-docs-sync.py` |
| Canonical README screenshots match their example HTML sources and recorded PNG digests | `python3 scripts/verify-screenshot-freshness.py` |
| README WebP previews match their PNGs, manifest, dimensions, and full-size links | `python3 scripts/test-build-readme-thumbs.py && python3 scripts/build-readme-thumbs.py --check` (requires `Pillow==12.1.1`) |
| Packaged output self-check behaves (pass + adversarial cases) | `python3 scripts/test-self-check.py` |
diff --git a/scripts/lint-skin.py b/scripts/lint-skin.py
index 1dad597..c999e08 100644
--- a/scripts/lint-skin.py
+++ b/scripts/lint-skin.py
@@ -56,6 +56,7 @@ ALLOWED_FONTS = {
"instrument serif",
"geist",
"geist mono",
+ "noto serif",
"hiragino sans",
"noto sans jp",
"yu gothic",
diff --git a/scripts/test-verify-docs-sync.py b/scripts/test-verify-docs-sync.py
index ed27f79..92e7bf8 100644
--- a/scripts/test-verify-docs-sync.py
+++ b/scripts/test-verify-docs-sync.py
@@ -7,6 +7,7 @@ import importlib.util
import json
import sys
import tempfile
+from contextlib import contextmanager
from pathlib import Path
@@ -103,6 +104,331 @@ def load_verify_module():
return module
+# Every file that carries the Google Fonts css2 link or the export @import.
+# The fixtures copy them from the real tree, so the passing case is the
+# shipped wiring and each mutation below is the only defect in the tree.
+FONT_SURFACES = (
+ "assets/template.html",
+ "assets/template-dark.html",
+ "assets/template-full.html",
+ "assets/template-motion.html",
+ "references/style-guide.md",
+ "references/export.md",
+ "SKILL.md",
+)
+# Spelled out here rather than read from the verifier: a surface or template
+# dropped from the verifier's own lists must fail a test, not shrink it.
+LINK_SURFACES = (
+ "assets/template-dark.html",
+ "assets/template-full.html",
+ "assets/template-motion.html",
+ "references/style-guide.md",
+ "SKILL.md",
+)
+TEMPLATES = (
+ "assets/template.html",
+ "assets/template-dark.html",
+ "assets/template-full.html",
+ "assets/template-motion.html",
+)
+NOTO_SERIF_FAMILY = "&family=Noto+Serif:ital@0;1"
+TITLE_ORDER = "'Instrument Serif', 'Noto Serif', 'Noto Serif KR'"
+
+
+def mutate(path: Path, old: str, new: str) -> bytes:
+ """Replace *old* once in *path* and return the original bytes."""
+ original = path.read_bytes()
+ text = original.decode("utf-8")
+ if old not in text:
+ raise AssertionError(f"{path.name} no longer contains {old!r}; update the fixture")
+ path.write_bytes(text.replace(old, new, 1).encode("utf-8"))
+ return original
+
+
+@contextmanager
+def font_fixture():
+ """Yield a temp root holding the shipped font surfaces, byte for byte."""
+ with tempfile.TemporaryDirectory(prefix="verify-docs-sync-fonts-") as temp_dir:
+ root = Path(temp_dir)
+ for relative in FONT_SURFACES:
+ target = root / "skills/diagram-design" / relative
+ target.parent.mkdir(parents=True, exist_ok=True)
+ target.write_bytes((ROOT / "skills/diagram-design" / relative).read_bytes())
+ yield root
+
+
+def run_checks(root: Path, *checks) -> list[str]:
+ errors: list[str] = []
+ for check in checks:
+ check(errors, root)
+ return errors
+
+
+def order_error(relative: str, face: str) -> str:
+ return (
+ f"{relative} --font-serif lists {face!r} before 'Noto Serif'; Google "
+ f"Fonts slices Cyrillic into {face} as well, so a Cyrillic title "
+ "would draw from it"
+ )
+
+
+def lacks_error(relative: str) -> str:
+ return (
+ f"{relative} --font-serif lacks 'Noto Serif'; Instrument Serif carries "
+ "no Cyrillic, so a Cyrillic title falls through to the next face"
+ )
+
+
+def link_error(relative: str) -> str:
+ return (
+ f"{relative} font link does not request Noto Serif, which its "
+ "--font-serif names for Cyrillic titles; without it they resolve "
+ "through whatever serif the viewer has installed"
+ )
+
+
+def check_font_link_parity(verify) -> None:
+ """Every css2 surface requests the template's families, each one checked."""
+ with font_fixture() as root:
+ skill = root / "skills/diagram-design"
+ errors = run_checks(root, verify.check_export_font_parity)
+ if errors:
+ raise AssertionError(f"shipped font links failed parity: {errors}")
+
+ for relative in LINK_SURFACES:
+ path = skill / relative
+ original = mutate(path, NOTO_SERIF_FAMILY, "")
+ errors = run_checks(root, verify.check_export_font_parity)
+ expected = (
+ f"{relative} font link drifts from assets/template.html: "
+ "missing Noto Serif"
+ )
+ if errors != [expected]:
+ raise AssertionError(f"{relative} dropping a family was not reported: {errors}")
+ path.write_bytes(original)
+
+ export = skill / "references/export.md"
+ original = mutate(export, "&family=Noto+Serif:ital@0;1", "")
+ errors = run_checks(root, verify.check_export_font_parity)
+ expected = (
+ "references/export.md @import omits Noto Serif, which "
+ "assets/template.html requests; an exported .svg would resolve "
+ "those scripts through whatever font the viewer happens to have"
+ )
+ if errors != [expected]:
+ raise AssertionError(f"export @import drift was not reported: {errors}")
+ export.write_bytes(original)
+
+ style_guide = skill / "references/style-guide.md"
+ original = mutate(
+ style_guide, "&display=swap", "&family=Roboto:wght@400&display=swap"
+ )
+ errors = run_checks(root, verify.check_export_font_parity)
+ expected = (
+ "references/style-guide.md font link drifts from assets/template.html: "
+ "extra Roboto"
+ )
+ if errors != [expected]:
+ raise AssertionError(f"an extra style-guide family was not reported: {errors}")
+ style_guide.write_bytes(original)
+ print("OK font links: every css2 surface requests the template's families")
+
+
+def check_title_stack_order(verify) -> None:
+ """Every --font-serif in every template reaches 'Noto Serif' first."""
+ with font_fixture() as root:
+ skill = root / "skills/diagram-design"
+ errors = run_checks(root, verify.check_title_fallback_order)
+ if errors:
+ raise AssertionError(f"shipped title stacks failed the fallback order: {errors}")
+
+ # Google Fonts slices Cyrillic into Noto Serif KR too, so a stack that
+ # reaches the Korean face first draws a Cyrillic title from it.
+ for relative in TEMPLATES:
+ path = skill / relative
+ original = mutate(
+ path, TITLE_ORDER, "'Instrument Serif', 'Noto Serif KR', 'Noto Serif'"
+ )
+ errors = run_checks(root, verify.check_title_fallback_order)
+ if errors != [order_error(relative, "Noto Serif KR")]:
+ raise AssertionError(
+ f"a CJK serif ahead of Noto Serif in {relative} was not reported: {errors}"
+ )
+ path.write_bytes(original)
+
+ # A dark-mode override is a second declaration, and the first one
+ # passing must not hide it. JP and HK carry a Cyrillic slice as well.
+ template = skill / "assets/template.html"
+ for face in ("Noto Serif JP", "Noto Serif HK"):
+ original = mutate(
+ template,
+ "</style>",
+ "@media (prefers-color-scheme: dark) {\n"
+ f" :root {{ --font-serif: 'Instrument Serif', '{face}', "
+ "'Noto Serif', serif; }\n"
+ " }\n"
+ " </style>",
+ )
+ errors = run_checks(root, verify.check_title_fallback_order)
+ if errors != [order_error("assets/template.html", face)]:
+ raise AssertionError(
+ f"a second --font-serif leading with {face} was not reported: {errors}"
+ )
+ template.write_bytes(original)
+
+ # Each distinct problem is reported once, in declaration order: an
+ # override repeated is one defect, and it does not hide a different one.
+ original = mutate(
+ template, TITLE_ORDER, "'Instrument Serif', 'Noto Serif KR', 'Noto Serif'"
+ )
+ override = (
+ "@media (prefers-color-scheme: dark) {\n"
+ " :root { --font-serif: 'Instrument Serif', 'Noto Serif JP', "
+ "'Noto Serif', serif; }\n"
+ " }\n"
+ " "
+ )
+ mutate(template, "</style>", override * 2 + "</style>")
+ errors = run_checks(root, verify.check_title_fallback_order)
+ expected = [
+ order_error("assets/template.html", "Noto Serif KR"),
+ order_error("assets/template.html", "Noto Serif JP"),
+ ]
+ if errors != expected:
+ raise AssertionError(f"stack errors were not each reported once: {errors}")
+ template.write_bytes(original)
+
+ motion = skill / "assets/template-motion.html"
+ original = mutate(motion, "'Noto Serif', ", "")
+ errors = run_checks(root, verify.check_title_fallback_order)
+ if errors != [lacks_error("assets/template-motion.html")]:
+ raise AssertionError(f"a stack without Noto Serif was not reported: {errors}")
+ motion.write_bytes(original)
+ print("OK title stacks: 'Noto Serif' leads every CJK serif face")
+
+
+def check_title_font_link(verify) -> None:
+ """A stack naming Noto Serif is only as good as the link that loads it."""
+ with font_fixture() as root:
+ mutate(
+ root / "skills/diagram-design/assets/template-motion.html",
+ NOTO_SERIF_FAMILY,
+ "",
+ )
+ errors = run_checks(
+ root, verify.check_export_font_parity, verify.check_title_fallback_order
+ )
+ expected = [
+ "assets/template-motion.html font link drifts from assets/template.html: "
+ "missing Noto Serif",
+ link_error("assets/template-motion.html"),
+ ]
+ if errors != expected:
+ raise AssertionError(f"a template link without Noto Serif was not reported: {errors}")
+
+ # A failing stack must not hide the failing link beside it.
+ with font_fixture() as root:
+ motion = root / "skills/diagram-design/assets/template-motion.html"
+ mutate(motion, "'Noto Serif', ", "")
+ mutate(motion, NOTO_SERIF_FAMILY, "")
+ errors = run_checks(
+ root, verify.check_export_font_parity, verify.check_title_fallback_order
+ )
+ expected = [
+ "assets/template-motion.html font link drifts from assets/template.html: "
+ "missing Noto Serif",
+ lacks_error("assets/template-motion.html"),
+ link_error("assets/template-motion.html"),
+ ]
+ if errors != expected:
+ raise AssertionError(f"a failing stack hid the failing link beside it: {errors}")
+
+ # Dropping the family from every copy at once leaves parity nothing to
+ # disagree about; only the templates' own links can still catch it.
+ with font_fixture() as root:
+ for relative in FONT_SURFACES:
+ family = (
+ "&amp;family=Noto+Serif:ital@0;1"
+ if relative == "references/export.md"
+ else NOTO_SERIF_FAMILY
+ )
+ mutate(root / "skills/diagram-design" / relative, family, "")
+ errors = run_checks(root, verify.check_export_font_parity)
+ if errors:
+ raise AssertionError(f"a coordinated removal should pass parity: {errors}")
+ errors = run_checks(root, verify.check_title_fallback_order)
+ expected = [link_error(relative) for relative in TEMPLATES]
+ if errors != expected:
+ raise AssertionError(f"a coordinated Noto Serif removal was not reported: {errors}")
+ print("OK title links: every template loads the Noto Serif its stack names")
+
+
+def check_style_guide_anchors(verify) -> None:
+ """SKILL.md's routing links must land on a heading, not only on the file."""
+ skill = verify.SKILL.read_text(encoding="utf-8")
+ errors: list[str] = []
+ verify.check_skill_reference_links(errors, skill, verify.SKILL.parent)
+ if errors:
+ raise AssertionError(f"shipped SKILL.md reference links failed: {errors}")
+
+ # Punctuation drops out of the slug and the spaces around it survive.
+ errors = []
+ verify.check_skill_reference_links(
+ errors,
+ "See [strokes](references/style-guide.md#stroke-radius-spacing) and "
+ "[inversion](references/style-guide.md#inversion-rule-light--dark).",
+ verify.SKILL.parent,
+ )
+ if errors:
+ raise AssertionError(f"punctuated style-guide headings failed: {errors}")
+
+ errors = []
+ verify.check_skill_reference_links(
+ errors,
+ skill + "\nSee [gone](references/style-guide.md#no-such-heading).\n",
+ verify.SKILL.parent,
+ )
+ expected = (
+ "SKILL.md links to 'references/style-guide.md#no-such-heading', "
+ "which matches no heading in references/style-guide.md"
+ )
+ if errors != [expected]:
+ raise AssertionError(f"a dangling style-guide anchor was not reported: {errors}")
+ print("OK style-guide anchors: every SKILL.md link lands on a heading")
+
+
+def check_heading_syntax(verify) -> None:
+ """Closing hashes are not heading text, and fenced lines are not headings."""
+ dangling = [
+ "SKILL.md links to 'references/style-guide.md#cyrillic-labels', "
+ "which matches no heading in references/style-guide.md"
+ ]
+ cases = (
+ ("# Style Guide\n\n### Cyrillic labels ###\n", []),
+ ("```\n### Not a heading\n```\n\n### Cyrillic labels\n", []),
+ ("# Style Guide\n\n```markdown\n### Cyrillic labels\n```\n", dangling),
+ ("# Style Guide\n\n~~~\n### Cyrillic labels\n~~~\n", dangling),
+ ("# Style Guide\n\n````\n```\n### Cyrillic labels\n```\n````\n", dangling),
+ # Only the opening character closes a fence, and a backtick run with
+ # another backtick after it on the line is a code span, not a fence.
+ ("# Style Guide\n\n```\n~~~\n### Cyrillic labels\n```\n", dangling),
+ ("```x``` inline\n\n### Cyrillic labels\n", []),
+ )
+ with tempfile.TemporaryDirectory(prefix="verify-docs-sync-anchors-") as temp_dir:
+ skill = Path(temp_dir)
+ guide = skill / "references/style-guide.md"
+ guide.parent.mkdir()
+ for text, expected in cases:
+ guide.write_text(text, encoding="utf-8")
+ errors: list[str] = []
+ verify.check_skill_reference_links(
+ errors, "See [Cyrillic](references/style-guide.md#cyrillic-labels).", skill
+ )
+ if errors != expected:
+ raise AssertionError(f"heading syntax misread in {text!r}: {errors}")
+ print("OK heading syntax: closing hashes stripped, fenced lines skipped")
+
+
def main() -> int:
verify = load_verify_module()
@@ -1061,10 +1387,18 @@ diagram-design/
raise AssertionError(f"valid asset citations produced unexpected error: {errs}")
print("OK reference assets: valid asset citations produce no error")
+ check_font_link_parity(verify)
+ check_title_stack_order(verify)
+ check_title_font_link(verify)
+ check_style_guide_anchors(verify)
+ check_heading_syntax(verify)
+
print(
- "PASS: docs sync checks references, asset citations, strict-bundler packaging, "
+ "PASS: docs sync checks references, style-guide anchors, asset citations, "
+ "strict-bundler packaging, "
"routing surfaces, Factory install contract, type-count routing, High-Level invariants, "
- "the type-ramp contract, and gallery guards (parent/variant model)"
+ "font-link parity, the Cyrillic title fallback order, the type-ramp contract, "
+ "and gallery guards (parent/variant model)"
)
return 0
diff --git a/scripts/test-verify-semantic-motion.py b/scripts/test-verify-semantic-motion.py
index 3203e7e..a32137c 100644
--- a/scripts/test-verify-semantic-motion.py
+++ b/scripts/test-verify-semantic-motion.py
@@ -97,6 +97,28 @@ def main() -> int:
):
raise AssertionError(f"missing lifecycle route was accepted: {errors}")
print("OK: missing lifecycle phase-map route is rejected")
+
+ # The byte cap is inclusive. Pad the real SKILL.md after its final
+ # newline so every other check still reads the shipped content.
+ skill_bytes = original_skill.read_bytes()
+ if len(skill_bytes) > 40_000:
+ raise AssertionError(
+ f"shipped SKILL.md is already {len(skill_bytes)} bytes; "
+ "the boundary cases need it at or under 40000"
+ )
+ for size, expected in (
+ (40_000, []),
+ (40_001, ["SKILL.md exceeds 40000 bytes: 40001 bytes"]),
+ ):
+ padded = scratch / f"skill-{size}.md"
+ padded.write_bytes(skill_bytes + b" " * (size - len(skill_bytes)))
+ module.SKILL = padded
+ errors = module.verify_markdown()
+ if errors != expected:
+ raise AssertionError(
+ f"SKILL.md byte cap at {size} bytes: expected {expected}, got {errors}"
+ )
+ print("OK: SKILL.md passes at 40000 bytes and is rejected at 40001")
finally:
module.SKILL = original_skill
diff --git a/scripts/verify-docs-sync.py b/scripts/verify-docs-sync.py
index 1cf4013..4a07877 100644
--- a/scripts/verify-docs-sync.py
+++ b/scripts/verify-docs-sync.py
@@ -1,7 +1,7 @@
#!/usr/bin/env python3
"""Verify that routing and browsing surfaces stay in sync with the skill.
-Twelve drift classes, each of which has shipped before:
+Fourteen drift classes, each of which has shipped before:
1. The SKILL.md frontmatter description is the only text an agent sees before
deciding to load the skill — every visual type in the selection table must
@@ -9,7 +9,8 @@ Twelve drift classes, each of which has shipped before:
2. The gallery (assets/index.html) must reach every shipped example, and every
gallery tab must point at a file that exists.
3. Every concrete file named in README.md's architecture tree must exist.
-4. Every relative references/*.md link in SKILL.md must resolve.
+4. Every relative references/*.md link in SKILL.md must resolve, and a link
+ into a style-guide.md section must name one of its headings.
5. Claude and Pi command/prompt surfaces must route to the matching reference.
6. Plugin descriptions must fit Cowork's installation limit while retaining
every type's lexical hook. The skill and Codex longDescription keep the
@@ -28,6 +29,11 @@ Twelve drift classes, each of which has shipped before:
references/output-spec.md, the ramp table keeps its five type roles across all
three presets, and every font-size in SKILL.md's §6 patterns is a canonical
role size or falls inside a named exception.
+13. Every copy of the Google Fonts css2 link must request the families
+ assets/template.html does, and the export @import must include them.
+14. Every --font-serif in a template must reach 'Noto Serif' before any CJK
+ serif face, which Google Fonts also slices Cyrillic into, and the
+ template's own font link must request it.
"""
from __future__ import annotations
@@ -293,12 +299,58 @@ def skill_reference_links(markdown: str) -> list[str]:
)
+CODE_FENCE = re.compile(r"[ \t]*(`{3,}|~{3,})")
+
+
+def heading_anchors(markdown: str) -> set[str]:
+ """GitHub-style heading slugs: lower-case, punctuation dropped, spaces to -.
+
+ ATX closing hashes (`### Title ###`) are stripped and lines inside ``` or
+ ~~~ fences are skipped, since neither is a heading GitHub would slug.
+ Not modelled: setext headings, indented code, HTML blocks, duplicate -1 suffixes.
+ """
+ anchors: set[str] = set()
+ fence = ""
+ for line in markdown.splitlines():
+ marker = CODE_FENCE.match(line)
+ if fence:
+ # Only a bare run of the same character, at least as long, closes it.
+ if (
+ marker
+ and marker.group(1)[0] == fence[0]
+ and len(marker.group(1)) >= len(fence)
+ and not line[marker.end():].strip()
+ ):
+ fence = ""
+ continue
+ # A backtick run followed by another backtick is a code span, not a fence.
+ if marker and not (marker.group(1)[0] == "`" and "`" in line[marker.end():]):
+ fence = marker.group(1)
+ continue
+ heading = re.match(r"#{1,6}[ \t]+(.+?)[ \t]*$", line)
+ if heading:
+ text = re.sub(r"(?:^|[ \t]+)#+$", "", heading.group(1))
+ anchors.add(re.sub(r"[^\w\- ]", "", text.strip().lower()).replace(" ", "-"))
+ return anchors
+
+
def check_skill_reference_links(
errors: list[str], markdown: str, skill_directory: Path
) -> None:
for target in sorted(set(skill_reference_links(markdown))):
if not (skill_directory / target).is_file():
errors.append(f"SKILL.md links to missing reference {target!r}")
+ # The compact Non-Latin routing line sends agents to style-guide.md
+ # sections; a renamed heading still resolves the file and lands on its top.
+ style_guide = skill_directory / "references/style-guide.md"
+ anchors = set(re.findall(r"\]\(references/style-guide\.md#([^)\s]+)\)", markdown))
+ if anchors and style_guide.is_file():
+ headings = heading_anchors(style_guide.read_text(encoding="utf-8"))
+ for anchor in sorted(anchors - headings):
+ errors.append(
+ f"SKILL.md links to 'references/style-guide.md#{anchor}', "
+ "which matches no heading in references/style-guide.md"
+ )
def check_reference_asset_links(
@@ -1159,6 +1211,35 @@ def check_manifest_descriptions(errors: list[str], root: Path) -> None:
)
+SKILL_PACKAGE = Path("skills/diagram-design")
+FONT_LINK = re.compile(r'href="([^"]*fonts\.googleapis\.com[^"]*)"')
+# Paths inside the skill package that carry the same css2 link as
+# assets/template.html. template-terminal.html is absent on purpose: the
+# terminal skin loads Geist Mono alone.
+FONT_LINK_SURFACES = (
+ Path("assets/template-dark.html"),
+ Path("assets/template-full.html"),
+ Path("assets/template-motion.html"),
+ Path("references/style-guide.md"),
+ Path("SKILL.md"),
+)
+TITLE_STACK_TEMPLATES = (
+ Path("assets/template.html"),
+ Path("assets/template-dark.html"),
+ Path("assets/template-full.html"),
+ Path("assets/template-motion.html"),
+)
+# Every Noto Serif CJK face Google Fonts serves also carries a cyrillic slice.
+CJK_SERIF_FACES = (
+ "Noto Serif KR",
+ "Noto Serif TC",
+ "Noto Serif SC",
+ "Noto Serif JP",
+ "Noto Serif HK",
+)
+SERIF_STACK = re.compile(r"--font-serif\s*:\s*([^;]+);")
+
+
def font_families(url: str) -> set[str]:
"""The `family=` parameters a Google Fonts css2 URL actually requests."""
return {
@@ -1168,24 +1249,31 @@ def font_families(url: str) -> set[str]:
}
-def check_export_font_parity(errors: list[str], root: Path) -> None:
- """The exported SVG must request every face the shipped HTML link does.
+def family_names(families: set[str]) -> str:
+ return ", ".join(name.removeprefix("family=").replace("+", " ")
+ for name in sorted(families))
- The two strings live in different files and drifted apart once already: the
- CJK faces reached assets/template.html but never the @import in export.md,
- so a Korean or Chinese diagram exported to .svg silently lost its type. That
- failure only shows up on a machine other than the author's, which is exactly
- the case the faces are in the link to prevent.
+
+def check_export_font_parity(errors: list[str], root: Path) -> None:
+ """Every copy of the Google Fonts link must request the same faces.
+
+ assets/template.html is the source. The other three templates, the style
+ guide's Font stack block, and SKILL.md carry the same css2 link and must
+ request exactly its families; the export @import must request at least
+ them. The strings live in different files and drifted apart once already:
+ the CJK faces reached assets/template.html but never the @import in
+ export.md, so a Korean or Chinese diagram exported to .svg silently lost its
+ type. That failure only shows up on a machine other than the author's,
+ which is exactly the case the faces are in the link to prevent.
"""
- template = root / "skills/diagram-design/assets/template.html"
- export = root / "skills/diagram-design/references/export.md"
+ template = root / SKILL_PACKAGE / "assets/template.html"
+ export = root / SKILL_PACKAGE / "references/export.md"
for path in (template, export):
if not path.is_file():
errors.append(f"font-parity surface is missing: {path.name}")
return
- link = re.search(r'href="([^"]*fonts\.googleapis\.com[^"]*)"',
- template.read_text(encoding="utf-8"))
+ link = FONT_LINK.search(template.read_text(encoding="utf-8"))
imported = re.search(r"@import url\('([^']+)'\)",
export.read_text(encoding="utf-8"))
if not link or not imported:
@@ -1195,16 +1283,93 @@ def check_export_font_parity(errors: list[str], root: Path) -> None:
)
return
- missing = sorted(font_families(link.group(1)) - font_families(imported.group(1)))
+ families = font_families(link.group(1))
+ missing = families - font_families(imported.group(1))
if missing:
- names = ", ".join(name.removeprefix("family=").replace("+", " ")
- for name in missing)
errors.append(
- f"references/export.md @import omits {names}, which "
+ f"references/export.md @import omits {family_names(missing)}, which "
f"assets/template.html requests; an exported .svg would resolve "
f"those scripts through whatever font the viewer happens to have"
)
+ for relative in FONT_LINK_SURFACES:
+ path = root / SKILL_PACKAGE / relative
+ if not path.is_file():
+ errors.append(f"font-parity surface is missing: {relative.as_posix()}")
+ continue
+ surface_link = FONT_LINK.search(path.read_text(encoding="utf-8"))
+ if not surface_link:
+ errors.append(f"could not locate the font link in {relative.as_posix()}")
+ continue
+ requested = font_families(surface_link.group(1))
+ drift = [
+ f"{label} {family_names(names)}"
+ for label, names in (
+ ("missing", families - requested),
+ ("extra", requested - families),
+ )
+ if names
+ ]
+ if drift:
+ errors.append(
+ f"{relative.as_posix()} font link drifts from assets/template.html: "
+ + "; ".join(drift)
+ )
+
+
+def title_stack_error(name: str, stack: str) -> str | None:
+ """Why one --font-serif value fails the Cyrillic order, or None."""
+ cjk = {face.casefold(): face for face in CJK_SERIF_FACES}
+ faces = [face.strip().strip("'\"").casefold() for face in stack.split(",")]
+ if "noto serif" not in faces:
+ return (
+ f"{name} --font-serif lacks 'Noto Serif'; Instrument Serif carries "
+ "no Cyrillic, so a Cyrillic title falls through to the next face"
+ )
+ ahead = [cjk[face] for face in faces[: faces.index("noto serif")] if face in cjk]
+ if ahead:
+ return (
+ f"{name} --font-serif lists {ahead[0]!r} before 'Noto Serif'; Google "
+ f"Fonts slices Cyrillic into {ahead[0]} as well, so a Cyrillic title "
+ "would draw from it"
+ )
+ return None
+
+
+def check_title_fallback_order(errors: list[str], root: Path) -> None:
+ """Every template --font-serif must reach 'Noto Serif' before a CJK serif.
+
+ Instrument Serif has no Cyrillic, so a Cyrillic page title draws from the
+ next face in the stack. Google Fonts slices Cyrillic into every Noto Serif
+ CJK face as well, so a stack that reaches one of them first renders the
+ title in a Korean, Chinese, or Japanese design's Cyrillic instead of the
+ face built for it. Every declaration counts, so an override such as a
+ dark-mode block cannot reorder the stack unseen. The template's own css2
+ link must also request Noto Serif: parity only compares the copies with
+ each other, so dropping the family from all of them at once passes it.
+ """
+ for relative in TITLE_STACK_TEMPLATES:
+ name = relative.as_posix()
+ path = root / SKILL_PACKAGE / relative
+ if not path.is_file():
+ errors.append(f"title-stack template is missing: {name}")
+ continue
+ source = path.read_text(encoding="utf-8")
+ stacks = SERIF_STACK.findall(source)
+ if not stacks:
+ errors.append(f"{name} has no --font-serif stack")
+ continue
+ for problem in dict.fromkeys(title_stack_error(name, stack) for stack in stacks):
+ if problem:
+ errors.append(problem)
+ link = FONT_LINK.search(source)
+ if not link or "family=Noto+Serif" not in font_families(link.group(1)):
+ errors.append(
+ f"{name} font link does not request Noto Serif, which its "
+ "--font-serif names for Cyrillic titles; without it they resolve "
+ "through whatever serif the viewer has installed"
+ )
+
def main() -> int:
errors: list[str] = []
@@ -1240,6 +1405,7 @@ def main() -> int:
)
check_routing_surfaces(errors, ROOT)
check_export_font_parity(errors, ROOT)
+ check_title_fallback_order(errors, ROOT)
if errors:
print("FAIL docs sync")
for error in errors:
@@ -1247,10 +1413,12 @@ def main() -> int:
return 1
print(
"OK docs sync: description hooks, gallery reachability, README tree, "
- "reference links, asset citations, packaged support files, routing surfaces, "
+ "reference links and style-guide anchors, asset citations, packaged support "
+ "files, routing surfaces, "
"manifest descriptions, Factory install contract, type-count routing, "
"High-Level invariants, onboarding trust boundary, Line dark-skin contract, "
- "export font parity, type-ramp contract, registered legacy type sizes"
+ "font-link parity, title fallback order, type-ramp contract, registered legacy "
+ "type sizes"
)
return 0
diff --git a/skills/diagram-design/SKILL.md b/skills/diagram-design/SKILL.md
index 304bfb9..48f2727 100644
--- a/skills/diagram-design/SKILL.md
+++ b/skills/diagram-design/SKILL.md
@@ -198,12 +198,12 @@ Type-specific anti-patterns live in each type reference linked in the guide.
- **Arrow label** — Geist Mono, 8px — annotation on arrows
- **Editorial aside** — Instrument Serif *italic*, 14px — callouts only
-**CJK labels** — Geist and Instrument Serif carry no Hangul or Han; extend the family and keep CJK at 12px+. Rules: [Korean](references/style-guide.md#korean-labels), [Chinese](references/style-guide.md#traditional-chinese-labels).
+**Non-Latin labels** — extend the family: [Korean](references/style-guide.md#korean-labels), [Chinese](references/style-guide.md#traditional-chinese-labels), [Cyrillic](references/style-guide.md#cyrillic-labels).
**Mono is for technical content only** — never as a blanket "dev" font, and never JetBrains Mono.
```html
-<link href="https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=Geist:wght@400;500;600&family=Geist+Mono:wght@400;500;600&family=Noto+Sans+KR:wght@400;500;600&family=Noto+Serif+KR:wght@400&family=Noto+Sans+TC:wght@400;500;600&family=Noto+Serif+TC:wght@400&display=swap" rel="stylesheet">
+<link href="https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=Geist:wght@400;500;600&family=Geist+Mono:wght@400;500;600&family=Noto+Serif:ital@0;1&family=Noto+Sans+KR:wght@400;500;600&family=Noto+Serif+KR:wght@400&family=Noto+Sans+TC:wght@400;500;600&family=Noto+Serif+TC:wght@400&display=swap" rel="stylesheet">
```
---
diff --git a/skills/diagram-design/assets/template-dark.html b/skills/diagram-design/assets/template-dark.html
index d9ed1a0..be75e5c 100644
--- a/skills/diagram-design/assets/template-dark.html
+++ b/skills/diagram-design/assets/template-dark.html
@@ -4,7 +4,7 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Diagram</title>
- <link href="https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=Geist:wght@400;500;600&family=Geist+Mono:wght@400;500;600&family=Noto+Sans+KR:wght@400;500;600&family=Noto+Serif+KR:wght@400&family=Noto+Sans+TC:wght@400;500;600&family=Noto+Serif+TC:wght@400&display=swap" rel="stylesheet">
+ <link href="https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=Geist:wght@400;500;600&family=Geist+Mono:wght@400;500;600&family=Noto+Serif:ital@0;1&family=Noto+Sans+KR:wght@400;500;600&family=Noto+Serif+KR:wght@400&family=Noto+Sans+TC:wght@400;500;600&family=Noto+Serif+TC:wght@400&display=swap" rel="stylesheet">
<style>
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
@@ -13,7 +13,7 @@
--color-muted: #bfc0c0;
--color-accent: #f08a59;
--font-sans: 'Geist', system-ui, sans-serif;
- --font-serif: 'Instrument Serif', 'Noto Serif KR', serif;
+ --font-serif: 'Instrument Serif', 'Noto Serif', 'Noto Serif KR', serif;
--font-mono: 'Geist Mono', ui-monospace, monospace;
}
diff --git a/skills/diagram-design/assets/template-full.html b/skills/diagram-design/assets/template-full.html
index ccef557..66b27d0 100644
--- a/skills/diagram-design/assets/template-full.html
+++ b/skills/diagram-design/assets/template-full.html
@@ -4,7 +4,7 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>[PROJECT NAME] Architecture</title>
- <link href="https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=Geist:wght@400;500;600&family=Geist+Mono:wght@400;500;600&family=Noto+Sans+KR:wght@400;500;600&family=Noto+Serif+KR:wght@400&family=Noto+Sans+TC:wght@400;500;600&family=Noto+Serif+TC:wght@400&display=swap" rel="stylesheet">
+ <link href="https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=Geist:wght@400;500;600&family=Geist+Mono:wght@400;500;600&family=Noto+Serif:ital@0;1&family=Noto+Sans+KR:wght@400;500;600&family=Noto+Serif+KR:wght@400&family=Noto+Sans+TC:wght@400;500;600&family=Noto+Serif+TC:wght@400&display=swap" rel="stylesheet">
<style>
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
@@ -21,7 +21,7 @@
--color-accent-tint: rgba(235,108,54,0.08);
--color-link: #2e5aa8;
--font-sans: 'Geist', system-ui, sans-serif;
- --font-serif: 'Instrument Serif', 'Noto Serif KR', 'Times New Roman', serif;
+ --font-serif: 'Instrument Serif', 'Noto Serif', 'Noto Serif KR', 'Times New Roman', serif;
--font-mono: 'Geist Mono', ui-monospace, Menlo, monospace;
}
diff --git a/skills/diagram-design/assets/template-motion.html b/skills/diagram-design/assets/template-motion.html
index f1983d6..7a4646c 100644
--- a/skills/diagram-design/assets/template-motion.html
+++ b/skills/diagram-design/assets/template-motion.html
@@ -4,7 +4,7 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Motion diagram template</title>
- <link href="https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=Geist:wght@400;500;600&family=Geist+Mono:wght@400;500;600&family=Noto+Sans+KR:wght@400;500;600&family=Noto+Serif+KR:wght@400&family=Noto+Sans+TC:wght@400;500;600&family=Noto+Serif+TC:wght@400&display=swap" rel="stylesheet">
+ <link href="https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=Geist:wght@400;500;600&family=Geist+Mono:wght@400;500;600&family=Noto+Serif:ital@0;1&family=Noto+Sans+KR:wght@400;500;600&family=Noto+Serif+KR:wght@400&family=Noto+Sans+TC:wght@400;500;600&family=Noto+Serif+TC:wght@400&display=swap" rel="stylesheet">
<style>
*, *::before, *::after { box-sizing: border-box; }
:root {
@@ -15,7 +15,7 @@
--color-accent: #eb6c36;
--color-rule: rgba(45,49,66,0.12);
--font-sans: 'Geist', system-ui, sans-serif;
- --font-serif: 'Instrument Serif', 'Noto Serif KR', serif;
+ --font-serif: 'Instrument Serif', 'Noto Serif', 'Noto Serif KR', serif;
--font-mono: 'Geist Mono', ui-monospace, monospace;
--motion-fast: 160ms;
--motion-step: 480ms;
diff --git a/skills/diagram-design/assets/template.html b/skills/diagram-design/assets/template.html
index fbd5f87..d617652 100644
--- a/skills/diagram-design/assets/template.html
+++ b/skills/diagram-design/assets/template.html
@@ -4,7 +4,7 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Diagram</title>
- <link href="https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=Geist:wght@400;500;600&family=Geist+Mono:wght@400;500;600&family=Noto+Sans+KR:wght@400;500;600&family=Noto+Serif+KR:wght@400&family=Noto+Sans+TC:wght@400;500;600&family=Noto+Serif+TC:wght@400&display=swap" rel="stylesheet">
+ <link href="https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=Geist:wght@400;500;600&family=Geist+Mono:wght@400;500;600&family=Noto+Serif:ital@0;1&family=Noto+Sans+KR:wght@400;500;600&family=Noto+Serif+KR:wght@400&family=Noto+Sans+TC:wght@400;500;600&family=Noto+Serif+TC:wght@400&display=swap" rel="stylesheet">
<style>
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
@@ -13,7 +13,7 @@
--color-muted: #4f5d75; /* blue-slate */
--color-accent: #eb6c36; /* atomic-tangerine */
--font-sans: 'Geist', system-ui, sans-serif;
- --font-serif: 'Instrument Serif', 'Noto Serif KR', serif;
+ --font-serif: 'Instrument Serif', 'Noto Serif', 'Noto Serif KR', serif;
--font-mono: 'Geist Mono', ui-monospace, monospace;
}
diff --git a/skills/diagram-design/references/export.md b/skills/diagram-design/references/export.md
index dec0162..9cf535b 100644
--- a/skills/diagram-design/references/export.md
+++ b/skills/diagram-design/references/export.md
@@ -35,7 +35,7 @@ If the user explicitly asks for "a screenshot of the whole page including the ca
- Inject Google Fonts `@import` so the SVG renders with correct typography in a browser. **XML-escape the `&` separators as `&amp;`** — a standalone `.svg` is parsed as strict XML, where a bare `&` starts an entity reference and makes the whole file fail to parse. (Don't copy the raw URL from the HTML `<link href>`; that ampersand form is only valid in HTML.)
```svg
<defs>
- <style>@import url('https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&amp;family=Geist:wght@400;500;600&amp;family=Geist+Mono:wght@400;500;600&amp;family=Noto+Sans+KR:wght@400;500;600&amp;family=Noto+Serif+KR:wght@400&amp;family=Noto+Sans+TC:wght@400;500;600&amp;family=Noto+Serif+TC:wght@400&amp;display=swap');</style>
+ <style>@import url('https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&amp;family=Geist:wght@400;500;600&amp;family=Geist+Mono:wght@400;500;600&amp;family=Noto+Serif:ital@0;1&amp;family=Noto+Sans+KR:wght@400;500;600&amp;family=Noto+Serif+KR:wght@400&amp;family=Noto+Sans+TC:wght@400;500;600&amp;family=Noto+Serif+TC:wght@400&amp;display=swap');</style>
</defs>
```
If the SVG already contains a `<defs>` block, **merge** the `<style>` into it (don't add a second `<defs>`).
diff --git a/skills/diagram-design/references/style-guide.md b/skills/diagram-design/references/style-guide.md
index 89d400a..730e78f 100644
--- a/skills/diagram-design/references/style-guide.md
+++ b/skills/diagram-design/references/style-guide.md
@@ -83,7 +83,7 @@ A self-contained palette for the terminal-window primitive (see [primitive-termi
### Font stack
```html
-<link href="https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=Geist:wght@400;500;600&family=Geist+Mono:wght@400;500;600&family=Noto+Sans+KR:wght@400;500;600&family=Noto+Serif+KR:wght@400&family=Noto+Sans+TC:wght@400;500;600&family=Noto+Serif+TC:wght@400&display=swap" rel="stylesheet">
+<link href="https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=Geist:wght@400;500;600&family=Geist+Mono:wght@400;500;600&family=Noto+Serif:ital@0;1&family=Noto+Sans+KR:wght@400;500;600&family=Noto+Serif+KR:wght@400&family=Noto+Sans+TC:wght@400;500;600&family=Noto+Serif+TC:wght@400&display=swap" rel="stylesheet">
```
### Korean labels
@@ -130,6 +130,20 @@ Three rules follow from Han metrics, mirroring the Hangul ones:
Simplified Chinese takes the same three rules with the Simplified stack (`'Noto Sans SC'`, `'PingFang SC'`, `'Microsoft YaHei'`). That face does not ship in the link, so Simplified labels still resolve through whatever the viewer has locally.
+### Cyrillic labels
+
+Geist and Geist Mono ship Cyrillic (`cyrillic` and `cyrillic-ext` on Google Fonts), so names, sublabels, arrow labels, eyebrows, and legend text in Bulgarian, Russian, Ukrainian, or Serbian keep the Latin treatment: same faces, sizes, tracking, and uppercase. There is no register switch: Hangul and Han switch register because Geist Mono has no face for them, and Geist Mono does cover Cyrillic.
+
+Instrument Serif carries no Cyrillic. A page title extends its family — `'Instrument Serif', 'Noto Serif', serif` — or a mixed Latin/Cyrillic title resolves Cyrillic through whatever face comes next and the two halves disagree. Noto Serif ships in the font link above, upright and italic, so an italic callout in Cyrillic takes the same stack.
+
+**Noto Serif goes ahead of the CJK serifs.** When a stack also lists `'Noto Serif KR'` or `'Noto Serif TC'`, put `'Noto Serif'` ahead of them. Google Fonts slices Cyrillic into those faces as well, so a stack that reaches a CJK face first draws its Cyrillic from it. That is why the templates put `'Noto Serif'` between `'Instrument Serif'` and `'Noto Serif KR'`; Noto Serif has no Hangul or Han, so Korean and Chinese titles pass straight through it.
+
+**Width budget.** The per-character contract above is unchanged: every character costs its face's Latin advance (0.60em sans, 0.62em mono). It fits Geist Mono exactly and Geist sans only on average. Geist Mono is monospaced: a Cyrillic glyph advances exactly as far as a Latin one, so sublabels, arrow labels, eyebrows, legend text, and their mask rects are sized as for Latin. Geist sans is not. Its wide Cyrillic letters, capitals and lowercase alike (such as `Ж Ш Щ Ю Ы`, `ж ш щ ы ю`), run well past the 0.60em average: `Шкаф ODF-2` at 12px is budgeted at 72px and draws at about 76. Rounding the box up to a multiple of 4 recovers at most 3px, so it is not the remedy. Leave the overshoot in the box padding and measure a Cyrillic sans name in the browser — `verify-treemap.py` holds the budget, not the drawn width, so it will not catch the overshoot.
+
+Counting by script is still the trap. `Шкаф ODF-2` is four Cyrillic letters, a space, three Latin letters, a hyphen, and a digit; a formula that tallies Cyrillic letters, Latin letters, and spaces silently drops `-` and `2` and sizes the box for eight of its ten characters.
+
+**Preserve printed labels.** A label the reader matches against a physical thing — a cabinet, a splice closure, a port map — carries the exact printed string. Don't transliterate it and don't re-case it; if one has to sit in an uppercase slot such as an eyebrow, drop the transform for that label rather than re-case the printed string. `Шкаф ODF-2` stays `Шкаф ODF-2`, not `Shkaf ODF-2`.
+
---
## Stroke, radius, spacing