Skip to content

docs: move the site's look into the shared styles - #67

Merged
shenxianpeng merged 2 commits into
mainfrom
feature/share-docs-theme
Sep 25, 2026
Merged

shenxianpeng merged 2 commits into
mainfrom
feature/share-docs-theme

Conversation

@shenxianpeng

@shenxianpeng shenxianpeng commented Sep 25, 2026 •

Copy link
Copy Markdown
Member

The home page redesign (#65) gave the site its paper and ink colors, a light header and new fonts (Instrument Sans, Bricolage Grotesque, JetBrains Mono), but put them in extra.css, which only this site loads. The docs sites load shared.css (#64), so https://cpp-linter.github.io/cpp-linter-action/ and the others still have Material's indigo header and Roboto.

This moves those rules from extra.css into shared.css unchanged, so all four docs sites pick them up with no change of their own:

  • cpp-linter-action (MkDocs)
  • cpp-linter (Sphinx, sphinx-immaterial)
  • clang-tools-pip (MkDocs)
  • cpp-linter-rs (MkDocs)

The fonts are self-hosted rather than imported from Google Fonts. An @import of fonts.googleapis.com in a stylesheet every docs site loads would hold up the first render on all of them, stall where Google Fonts is blocked, and send each visitor's IP address to Google. docs/fonts/ has the latin and latin-ext subsets of the three variable fonts (ten woff2 files, 274 KB; a page downloads only the files it uses, about 135 KB for plain English text) and their OFL licenses. shared.css declares them with @font-face and URLs relative to itself, so the other docs sites fetch them from cpp-linter.github.io too; GitHub Pages sends Access-Control-Allow-Origin: *, so a docs site previewed locally loads them as well. This site preloads the latin files for text and headings.

extra.css keeps what only this site uses: the merch grid, the readable width for pages without a left navigation, and the comparison and size-chart tables.

Checked

  • Self-hosted fonts: the home page and a copy of the cpp-linter-action and cpp-linter (Sphinx) docs pages pointed at the local shared.css make no request to Google for these fonts, load them from /fonts/ once each, and render in Instrument Sans, Bricolage Grotesque and JetBrains Mono. mkdocs build --strict and the pre-commit hooks pass.

  • Local build: the computed styles of /getting-started/ (background, header, headings, body text, code, links, search) match the live site exactly.

  • The new shared.css swapped into the live pages of all four docs sites, light and dark: each gets the paper background, the light header, the fonts and the warm code blocks, with nothing broken, including the Sphinx site.

Once this is deployed, the docs sites can set theme.font: false so Material stops loading Roboto they no longer use; cpp-linter-action does in its own PR.

@netlify

netlify Bot commented Sep 25, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for cpp-linter-github-io ready!

Name Link
🔨 Latest commit 2133bbe
🔍 Latest deploy log https://app.netlify.com/projects/cpp-linter-github-io/deploys/6ab6193cac1ac100089b5df1
😎 Deploy Preview https://deploy-preview-67--cpp-linter-github-io.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Comment thread docs/stylesheets/shared.css Outdated
The home page redesign put the paper and ink colors, the light header and
the fonts in extra.css, which only this site loads. The product docs sites
load shared.css, so they kept Material's default indigo header and Roboto
and no longer look like the hub they link back to.

Move those rules into shared.css unchanged, and import the fonts there so a
site gets them without a template of its own. extra.css keeps the rules
only this site uses: the merch grid, the readable width for pages without
a left navigation, and the comparison and size-chart tables.
shared.css imported the fonts from fonts.googleapis.com. As an @import
in a stylesheet that every docs site loads, that request held up the
first render on all of them, stalled where Google Fonts is blocked, and
sent each visitor's IP address to Google.

The latin and latin-ext subsets of the three variable fonts (Instrument
Sans, Bricolage Grotesque and JetBrains Mono: ten woff2 files, 274 KB)
now live in docs/fonts with their OFL licenses, and shared.css declares
them with @font-face. The URLs are relative to shared.css, so the other
docs sites get the fonts from cpp-linter.github.io as well. This site
preloads the latin files for text and headings instead of linking
Google Fonts.
@shenxianpeng
shenxianpeng force-pushed the feature/share-docs-theme branch from eee5d7f to 2133bbe Compare September 25, 2026 06:48
@shenxianpeng
shenxianpeng merged commit a6614c0 into main Sep 25, 2026
7 checks passed
@shenxianpeng
shenxianpeng deleted the feature/share-docs-theme branch September 25, 2026 07:06
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.

2 participants