Repository navigation
fix(theme): bundle code snippet language icons locally - #1595
Merged
Merged
Conversation
The language icons in the code snippet tabs were hot-linked from raw.githubusercontent.com (devicons/devicon). GitHub serves raw .svg files as `text/plain` with `X-Content-Type-Options: nosniff`, so browsers download them (HTTP 200) but refuse to render them as images via CSS `background: url()`. The icons silently stopped rendering. Vendor the 18 SVGs into the theme package and repoint the SCSS at local relative paths so icon rendering no longer depends on GitHub's raw-content headers or network access. Icons are from devicon v2.17.0 (MIT). Co-Authored-By: Claude Opus 4.8 <[email protected]>
Relative url("./icons/*.svg") in a SCSS partial fails to resolve under
rspack (Docusaurus Faster) because url() is resolved relative to the entry
styles.scss, not the partial — CI failed with
RspackResolver(NotFound("./icons/python.svg")).
Inline the 18 icons as base64 SVG data URIs (matching the existing http and
shell tabs). Self-contained, bundler-agnostic, no network dependency.
Icons vendored from devicon v2.17.0 (MIT). Remove the now-unused icons/ dir.
Co-Authored-By: Claude Opus 4.8 <[email protected]>
|
Size Change: +44.8 kB (+1.9%) Total Size: 2.4 MB 📦 View Changed
ℹ️ View Unchanged
|
|
Visit the preview URL for this PR (updated for commit 9160560): (expires Tue, 18 Aug 2026 13:25:26 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: bf293780ee827f578864d92193b8c2866acd459f |
Co-Authored-By: Claude Opus 4.8 <[email protected]>
📸 Visual Diff ReportSnapshot comparison against https://docusaurus-openapi.tryingpan.dev/
❌ 74 page(s) with visual regressions
|
| Prod | Preview | Diff |
![]() |
![]() |
![]() |
/tests/all-of-override-of-nested-array-items-with-one-of
| Prod | Preview | Diff |
![]() |
![]() |
![]() |
/tests/all-of-with-additional-properties-false-on-every-member
| Prod | Preview | Diff |
![]() |
![]() |
![]() |
/tests/all-of-with-deep-merging
| Prod | Preview | Diff |
![]() |
![]() |
![]() |
/tests/all-of-with-explicit-empty-object-properties
| Prod | Preview | Diff |
![]() |
![]() |
![]() |
/tests/all-of-with-enum-parameter
| Prod | Preview | Diff |
![]() |
![]() |
![]() |
/tests/all-of-with-array-items
| Prod | Preview | Diff |
![]() |
![]() |
![]() |
/tests/all-of-with-incompatible-types
| Prod | Preview | Diff |
![]() |
![]() |
![]() |
/tests/all-of-with-nested-all-of
| Prod | Preview | Diff |
![]() |
![]() |
![]() |
/tests/all-of-with-properties-in-array-item
| Prod | Preview | Diff |
![]() |
![]() |
![]() |
/tests/all-of-with-same-level-properties
| Prod | Preview | Diff |
![]() |
![]() |
![]() |
/tests/all-of-with-shared-required-properties
| Prod | Preview | Diff |
![]() |
![]() |
![]() |
/tests/control-no-x-code-samples
| Prod | Preview | Diff |
![]() |
![]() |
![]() |
/tests/cookie-parameter-default
| Prod | Preview | Diff |
![]() |
![]() |
![]() |
/tests/create-user-nested-request-body
| Prod | Preview | Diff |
![]() |
![]() |
![]() |
/tests/custom-verb-endpoint-in-path
| Prod | Preview | Diff |
![]() |
![]() |
![]() |
/tests/duplicate-lang-label-defensive-collision-suffix
| Prod | Preview | Diff |
![]() |
![]() |
![]() |
/tests/example-in-request-parameters-schema
| Prod | Preview | Diff |
![]() |
![]() |
![]() |
/tests/example-in-request-parameters
| Prod | Preview | Diff |
![]() |
![]() |
![]() |
/tests/example-of-media-type-object-in-response
| Prod | Preview | Diff |
![]() |
![]() |
![]() |
/tests/example-of-media-type-object-in-request-body
| Prod | Preview | Diff |
![]() |
![]() |
![]() |
/tests/example-of-schema-in-request-body
| Prod | Preview | Diff |
![]() |
![]() |
![]() |
/tests/example-of-properties-in-request-body-schema
| Prod | Preview | Diff |
![]() |
![]() |
![]() |
/tests/example-of-schema-in-response
| Prod | Preview | Diff |
![]() |
![]() |
![]() |
/tests/example-of-schema-properties-in-response
| Prod | Preview | Diff |
![]() |
![]() |
![]() |
… and 49 more page(s) with regressions. See the HTML report for the full list.
Updated at 2026-08-11T13:32:22.854Z · run 31495769843
The inlined devicon SVGs have a viewBox but no intrinsic width/height, so without background-size the icons rendered inconsistently. Match the http/shell icons which already set background-size: contain. Co-Authored-By: Claude Opus 4.8 <[email protected]>
Literal non-ASCII glyphs made dart-sass prepend a UTF-8 BOM to the compiled stylesheet. Mid-bundle that BOM invalidated the following :root selector, dropping --code-tab-logo-width/height so code-tab icons rendered at 0x0. Emit the glyphs as ASCII CSS escapes via string.unquote to keep output BOM-free. Co-Authored-By: Claude Opus 4.8 <[email protected]>
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.











































































Problem
Code snippet language icons stopped rendering even though fetching the SVGs returns HTTP 200.
The icons in the code snippet tabs were hot-linked from
raw.githubusercontent.com(thedevicons/deviconrepo) via CSSbackground: url(). GitHub serves raw.svgfiles with:Content-Type: text/plain(notimage/svg+xml)X-Content-Type-Options: nosniffSo the browser downloads each file successfully (200) but
nosniffforbids treating atext/plainresponse as an image — the icon is silently dropped. This is long-standing GitHub behavior, not a recent GitHub change; the failure surfaced independent of any code change here.Fix
packages/docusaurus-theme-openapi-docs/src/theme/ApiExplorer/CodeTabs/icons/(fromdeviconv2.17.0, MIT).background: url(...)refs in_CodeTabs.scssfromraw.githubusercontent.comto local./icons/<lang>.svg.icons/README.mddocumenting source, license, and rationale.Icon rendering no longer depends on GitHub's raw-content headers or network access. The
httpandshelltabs were already inline data URIs and are untouched.Verification
raw.githubusercontentrefs remain in the SCSS.yarn buildpasses; the copy step ships all 18 SVGs and the SCSS intolib/, sourl("./icons/*.svg")resolves through the consumer's css-loader at build time.🤖 Generated with Claude Code