feat(docs): add a print stylesheet for documentation pages (DX-063) - #638
Merged
IbrahimIjai merged 1 commit intoAug 30, 2026
Merged
Conversation
Reference pages — particularly /resources/terms and /concepts/risk — get printed and saved as PDFs. Without print rules the output is a navigation header followed by whatever the active theme happens to be. - apps/docs/src/styles/print.css (new): @media print rules that hide the page chrome (static header, DocsLayout sidebar/TOC/header/footer slots, search dialog, mobile TOC, heading anchors), force the light palette by re-declaring the dark-theme token overrides, expand the content column, open every collapsible and tab panel, print destination URLs after internal links, keep code blocks/callouts/table rows unsplit, and show a print-only footer with the page URL and last-updated date. - the rules live in a docs-print cascade layer declared before Tailwind's layers, so their !important rules beat the base preflight [hidden]{display:none!important} that guards inactive tab panels. - the static generator emits the print footer (canonical URL from seo.ts DEFAULT_SITE_URL + frontmatter updated date) — no client JS needed. - the content-map Tabs now keep every panel mounted (inactive ones hidden) so print/search can reach them, matching the primitives Tabs convention. - DocsLayout marks its chrome regions with data-slot hooks the print sheet targets. Also repairs pre-existing docs-gate defects on main that blocked building and verifying this change: - scripts/build.ts: drop the orphaned inline-styled page template left by the SO4-Markets#636 merge and restore the vite stylesheet pipeline it clobbered. - scripts/check-content.ts: the glossary check read entry.answer, a field headingEntries() no longer returns (crash); read each entry's own section. The home page is reachable by definition, so it is exempt from the orphan-page check. - scripts/generate-faq.ts: same stale entry.answer usage (crash); derive each entry's answer from its FAQ section body. - mdx/components.tsx: remove the imported Tabs that conflicted with the local Tabs declaration (TS2440). Closes SO4-Markets#575
|
@Ay-obami is attempting to deploy a commit to the Ijai's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
@Ay-obami Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
4 tasks
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.
Closes #575
Closes #582
Closes #579
Summary
Adds a print stylesheet for the documentation site so reference pages (particularly
/resources/termsand/concepts/risk) print as clean, light, content-only documents instead of a navigation header followed by theme-dependent, unreadable output.apps/docs/src/styles/print.css(new) —@media printrules that:DocsLayoutsidebar/TOC/header/footer (data-slothooks), search dialog, mobile TOC, heading anchors, and the (not-yet-built) reading-progress / feedback controls via documented hooks;.darkblock inpackages/ui/src/styles/globals.cssoverrides with that file's:rootlight values;data-tab-labelprefixes so the reader can still tell the alternatives apart;main a[href^="/"]::after);break-inside: avoid+ repeatingthead);docs-printcascade layer declared before Tailwind'stheme, base, components, utilitieslayers, so their!importantrules beat the base-layer preflight[hidden] { display: none !important }that guards inactive tab panels (Base UIkeepMountedpanels and the contentTabsboth hide inactive panels with thehiddenattribute).scripts/build.tsrenders the print footer (canonical URL from the newDEFAULT_SITE_URLinsrc/lib/seo.ts+ the frontmatterupdateddate) — no client JS is needed for any print path, including headless PDF export.mdx/components.tsxcontentTabsnow keep every panel mounted (inactive ones hidden via thehiddenattribute), so print/search can reach content that was previously never rendered to the DOM; this matches the primitives-basedTabs(keepMounted) convention.mdx/Tabs.tsxpanels carrydata-tab-label.DocsLayout.tsxmarks its chrome regions withdata-slothooks (docs-shell/header/sidebar/toc/footer) that the print sheet targets.Pre-existing
maindefects repaired (required to build/verify this change)scripts/build.ts— the feat(docs): implement DX-027, DX-030, DX-033, and DX-037 #636 merge left an orphaned inline-styled page template referencing undefined variables, and removed the vite stylesheet build that the page template's/assets/${stylesheet}link depends on. Restored thebunx vite build+ hashed-stylesheet pipeline;bun run --cwd apps/docs buildnow completes (25 static routes).scripts/check-content.ts— the glossary check crashed onentry.answer(a fieldheadingEntries()no longer returns); it now reads each entry's own section of the glossary body. The home page is reachable by definition, so it is exempted from the orphan-page check.scripts/generate-faq.ts— same staleentry.answercrash; each FAQ entry's answer is now derived from its own section body.mdx/components.tsx— removed theimport { Tab, Tabs } from "./Tabs"that conflicted with the localTabsdeclaration (TS2440).Verification
bun run --cwd apps/docs build— all content gates pass, 25 static routes + Pagefind-ready output.bun test(apps/docs) — 54 pass / 12 fail / 3 errors; the failures are identical on cleanmain(pre-existing:Sidebar/Pagerroute fixtures,docs shortcuts, test-hook timeouts) plus a new passing testMDX content tabs keep every panel mounted for print and search./resources/terms—terms.pdf/concepts/risk—risk.pdf/resources/faq—faq.pdfLast updated <date> · https://docs.so4.market/<route>, internal links print their destination (… (/concepts/risk)), and dark-theme variants (terms-dark-active.pdf,risk-dark-active.pdf) print identically in the light palette when.darkis forced on<html>.print-exports/folder — attach the three PDFs to this PR (GitHub doesn't accept file uploads via the API).Notes
mainyet. The print sheet hides the header (where DX-062's indicator is specified to live) and documentsdata-reading-progress/data-page-feedback/print:hiddenas the convention for components that land later./resources/termsisstatus: draft, so the real build intentionally excludes it; its PDF was rendered locally with the exact production template (print-exports/render-draft-terms.ts) for verification only.<pre>/<table>/tabs yet (the full MDX pipeline is deferred per the DX-097–100 note indocs/dx_1/001_docs_site.md); the print rules for those elements are in place and verified via the fixture harness so they apply the moment the renderer catches up.--surface-*/--text-*and statussubtletoken values are not declared in:rootupstream (light mode currently degrades via inheritance, and thesubtlefills are dark tints that print as near-black boxes); print states the surface/text values explicitly and neutralizes callout fills to bordered boxes so printed callouts are readable.