Skip to content

✨ Add sd_fontawesome_version for version-agnostic icon roles#288

Merged
chrisjsewell merged 1 commit into
mainfrom
feat/fontawesome-version
Jul 15, 2026
Merged

✨ Add sd_fontawesome_version for version-agnostic icon roles#288
chrisjsewell merged 1 commit into
mainfrom
feat/fontawesome-version

Conversation

@chrisjsewell

@chrisjsewell chrisjsewell commented Jul 15, 2026

Copy link
Copy Markdown
Member

Decouples FontAwesome role names from the CSS class scheme they emit, so users never touch their documents when changing FA versions — the follow-up agreed in #285's review discussion.

Design

New TOML-representable option:

sd_fontawesome_version = "as-named"   # or "4" | "5" | "6"
  • "as-named" (default): today's exact behaviour — the role name is emitted verbatim as the leading class. Byte-parity with main proven by sha256 over a build exercising all seven role spellings.
  • A version value: any role spelling becomes a pure style selector and emits that version's class scheme — :fas:rocket and `:fa-solid:`rocket both produce fa-solid fa-rocket under "6", fas fa-rocket under "5", fa fa-rocket under "4" (v4 had no style prefixes; bare fa maps to solid under 5/6). Upgrading FontAwesome is then a one-line conf.py change; with "6", the concise spellings also work with Pro kits.
  • LaTeX output is fully version-independent: the semantic style now travels on the node (icon_style attribute), so fontawesome5 rendering (\faIcon[regular]{…} etc.) is identical for every version value — including "4", whose HTML-side style collapse no longer leaks into PDFs (a review finding, fixed by storing the style rather than re-deriving it from the emitted class).
  • Docs lead with the version-agnostic story; the icon-name churn caveat stays (renames across FA versions are emitted as written, HTML and LaTeX alike).

Verification

  • Independent review (merge-safe): as-named byte-parity independently reproduced (identical sha256 across main / branch-default / branch-explicit, HTML and .tex); config flip verified to re-read all documents on incremental builds (rebuild="env" — parse-time class baking is safe); extra-classes microsyntax preserved under translation; nested contexts (buttons/cards/dropdowns) clean; parallel -j4 reads consistent; invalid value warns and falls back.
  • LaTeX invariance now locked by a test parametrized over all four version values.
  • Full suite on pinned Sphinx 7.2.6 / 7.4.7 / 8.2.3 (246–249 passed per revision); the only fixture change is the icon_style attribute appearing on fontawesome nodes (audited).

Follow-up to #285 / #174

The role name now acts as a pure style selector (solid/brands/regular):
set sd_fontawesome_version = "4" | "5" | "6" and every role spelling
emits that version's class scheme, so upgrading FontAwesome is a one-line
conf.py change. The default "as-named" emits the role name verbatim,
byte-identical to previous releases. LaTeX rendering is unaffected.
@chrisjsewell chrisjsewell force-pushed the feat/fontawesome-version branch from a6dc3f2 to 8f6796e Compare July 15, 2026 11:20
@codecov

codecov Bot commented Jul 15, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.63%. Comparing base (58eca26) to head (8f6796e).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #288      +/-   ##
==========================================
+ Coverage   92.60%   92.63%   +0.03%     
==========================================
  Files          13       13              
  Lines        1365     1371       +6     
==========================================
+ Hits         1264     1270       +6     
  Misses        101      101              
Flag Coverage Δ
pytests 92.63% <100.00%> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@chrisjsewell chrisjsewell merged commit 05d61f3 into main Jul 15, 2026
25 checks passed
@chrisjsewell chrisjsewell deleted the feat/fontawesome-version branch July 15, 2026 11:46
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