Skip to content

fix(approach): prefer element icons over the numbered digit - #182

Merged
markdumay merged 1 commit into
mainfrom
fix/approach-numbered-element-icons
Jul 28, 2026
Merged

fix(approach): prefer element icons over the numbered digit#182
markdumay merged 1 commit into
mainfrom
fix/approach-numbered-element-icons

Conversation

@markdumay

Copy link
Copy Markdown
Contributor

Summary

Follow-up to #181. On sites whose icon defaultFamily has no bare digit names — including hinode's own exampleSite default (bi, Bootstrap Icons) — numbered: true rendered empty badges with Cannot find icon errors, because the auto-digit fallback assumed the family ships 19 glyphs.

Fix, aligned with the cards convention: a numbered element's own icon now takes precedence in the tinted circle (resolved like any element icon, in both grid and split layouts); the bare-digit auto-numbering remains as the fallback for families that ship digit glyphs (fas, Flaticon families, …). The family requirement is documented in the approach.yml argument spec, and the example there shows explicit icons with the digit fallback.

Verification

  • exampleSite build clean; render checks across five combinations (grid/split × numbered/plain + mixed per-element icons showing correct precedence).
  • Acceptance test on hinode's exampleSite (defaultFamily = "bi"): with explicit 1-circle/2-circle/3-circle element icons the badges render real bi SVG symbols; the previous Cannot find icon: bi/1.svg errors are gone.
  • Default path (unnumbered) remains untouched.

A companion mod-docs example update (explicit icons) is staged on gethinode/mod-docs#131.

🤖 Generated with Claude Code

Align numbered: true with the cards convention of per-element named
icons, instead of always overriding to a bare digit. When numbered
and an element sets icon, that icon renders in the tinted circle
(resolved exactly like any element icon: family prefix optional,
bare names go through defaultFamily). Only elements without an icon
fall back to the bare digit glyph. Applies in both the card grid and
the split layout; per-element image is still always ignored.

Root cause this addresses: the bare-digit fallback only renders a
visible glyph when the resolved icon family ships plain digit names
(fas, fi-* do). Bootstrap Icons ("bi") does not — it only has
compound names like "1-circle" — so a numbered block on a site
defaulting to "bi" rendered empty circles. Confirmed by smoke-
testing against gethinode/hinode's own exampleSite, which sets
defaultFamily to "bi": with an explicit element icon like
"1-circle", the badge now resolves a real "bi" glyph instead of the
missing "bi/1.svg" the old bare-digit path asked for.

Documents the family requirement in the component comment,
approach.bookshop.yml's numbered field, and approach.yml's comment
and example (now mixes element icons with an icon-less element to
show both paths in one block).

Default (no numbered, no layout) path re-verified byte-identical.
Extended the four-combination render check to five: grid/split x
(no-icon digit fallback, mixed element-icon-and-fallback) plus the
existing split-without-numbered case; inspected rendered HTML
directly for each.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@markdumay
markdumay merged commit cda0bc1 into main Jul 28, 2026
8 checks passed
@markdumay

Copy link
Copy Markdown
Contributor Author

🎉 This PR is included in version 2.3.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@markdumay
markdumay deleted the fix/approach-numbered-element-icons branch July 28, 2026 18:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant