Skip to content

Give each docs figure its own arrowhead markers - #20

Merged
juicycleff merged 2 commits into
mainfrom
docs-diagram-marker-ids
Aug 2, 2026
Merged

Give each docs figure its own arrowhead markers#20
juicycleff merged 2 commits into
mainfrom
docs-diagram-marker-ids

Conversation

@juicycleff

Copy link
Copy Markdown
Contributor

What

Every Figure in the docs diagram kit rendered its own copy of <marker id="fabriq-arrow"> and its accent twin. Two pages render two diagrams each, (concepts)/architecture and (concepts)/caching, so both ids appeared twice on each. It rendered correctly, because the markers are identical and url(#id) resolves to the first match, but duplicate ids are invalid HTML and fail an axe duplicate-id rule.

Figure already derives an id from its title for aria-labelledby. The markers join that scheme as ${id}-arrow and ${id}-arrow-accent.

Getting that scope to the 36 Arrow call sites is the awkward part: these render as server components, so there is no context and no useId to carry it. Figure passes a pre-bound Arrow to its children instead, and both Defs and the unbound Arrow become private. An arrow naming a marker that no <defs> on the page defines is now unrepresentable rather than merely discouraged.

architecture-diagram.tsx also carried its own copy of the ten colour constants, Chip, TierTag, Arrow, Defs and Node, plus an inline figure/svg wrapper instead of Figure. That is why the marker fix would otherwise have had to be made twice, and why an edit to the kit never reached the two most-used diagrams. It imports from ./diagram-kit now, roughly 200 lines lighter.

Verification

All eight diagrams rendered before and after with renderToStaticMarkup: markup is identical once ids are normalised away, and every url(#...) resolves to a marker defined in its own figure.

The same check against the pre-change code reports both pages at 8 ids, 6 distinct, naming fabriq-arrow and fabriq-arrow-accent. Against this branch both report 8 of 8 distinct. The check fails if the old code shows no duplicates, so the pass is not vacuous.

tsc --noEmit and biome check both clean.

Note on scope

This branch was cut from docs-link-repairs, so it also carries 4fe8653, which repoints four docs links at pages that exist. That commit was not previously pushed anywhere.

Defs() emitted <marker id="fabriq-arrow"> and its accent twin, and every
Figure rendered its own copy. Two pages render two diagrams each, so both
ids appeared twice on each: (concepts)/architecture and (concepts)/caching.
It rendered correctly, because the markers were identical and url(#id)
resolves to the first match, but duplicate ids are invalid HTML and fail an
axe duplicate-id rule. The comment calling the duplication harmless was
true of the rendering, not of the markup.

Figure already derives an id from its title for aria-labelledby. The markers
now join that scheme as ${id}-arrow and ${id}-arrow-accent. The fabriq-
prefix goes: it existed to namespace an id that was global to the document,
and keeping it would leave one function emitting ids under two conventions
three lines apart.

Getting the scope to the 36 Arrow call sites is the awkward part, because
these render as server components, so there is no context and no useId to
carry it. Figure passes a pre-bound Arrow to its children instead, and both
Defs and the unbound Arrow become private. An arrow that names a marker no
defs on the page defines is now unrepresentable rather than merely
discouraged, which is what the old arrangement could not offer.

architecture-diagram.tsx also carried its own copy of the ten colour
constants, Chip, TierTag, Arrow, Defs and Node, plus an inline figure/svg
wrapper instead of Figure. That is why the marker fix would otherwise have
had to be made twice, and why an edit to the kit never reached the two
most-used diagrams on the site. It imports from ./diagram-kit now, roughly
200 lines lighter.

Verified by rendering all eight diagrams before and after with
renderToStaticMarkup: the markup is identical once ids are normalised away.
The same check run against the old code reports both pages at 8 ids and 6
distinct, naming fabriq-arrow and fabriq-arrow-accent; against the new code
both pages report 8 of 8 distinct, with every url(#...) resolving to a
marker defined in its own figure.
@vercel

vercel Bot commented Aug 2, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
fabriq Ready Ready Preview Aug 2, 2026 6:45pm

Request Review

@juicycleff
juicycleff merged commit ab56998 into main Aug 2, 2026
12 checks passed
@juicycleff
juicycleff deleted the docs-diagram-marker-ids branch August 2, 2026 19:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant