Skip to content

feat(pdf): whole-product PDF export with download button on OPCP landing page#329

Draft
Y0Coss wants to merge 5 commits into
developfrom
feat/product-pdf-export
Draft

feat(pdf): whole-product PDF export with download button on OPCP landing page#329
Y0Coss wants to merge 5 commits into
developfrom
feat/product-pdf-export

Conversation

@Y0Coss

@Y0Coss Y0Coss commented Jul 2, 2026

Copy link
Copy Markdown
Collaborator

Bundle a product's landing page + all descendant guides into one PDF with a nested outline, clickable TOC, running header/footer and OVHcloud cover branding.

  • scripts/pdf/: engine-agnostic core (sidebar resolver, MDX sanitizer, digest) plus a local Chromium generator (pdf:local) and a pandoc/weasyprint Dockerfile for CI.
  • PdfDownloadButton: frontmatter opt-in (pdf: ), mounted in LandingLayout since the Ask-AI cluster is absent there; opens the PDF inline in a new tab.
  • i18n: relabel to 'Download full documentation (PDF)' across all 7 locales.
  • Staging: commit a pre-generated OPCP PDF under static-pdfs/ and copy it into dist/pdfs/ at build time (build:static-pdfs) so CDS needs no pandoc/Chromium.

Y0Coss added 5 commits July 2, 2026 08:44
…ing page

Bundle a product's landing page + all descendant guides into one PDF with a nested
outline, clickable TOC, running header/footer and OVHcloud cover branding.

- scripts/pdf/: engine-agnostic core (sidebar resolver, MDX sanitizer, digest) plus
  a local Chromium generator (pdf:local) and a pandoc/weasyprint Dockerfile for CI.
- PdfDownloadButton: frontmatter opt-in (pdf: <ref>), mounted in LandingLayout since
  the Ask-AI cluster is absent there; opens the PDF inline in a new tab.
- i18n: relabel to 'Download full documentation (PDF)' across all 7 locales.
- Staging: commit a pre-generated OPCP PDF under static-pdfs/ and copy it into
  dist/pdfs/ at build time (build:static-pdfs) so CDS needs no pandoc/Chromium.
Section titles in the outline/TOC came from index.md (EN-only); now resolved via the
sidebar.gen.* i18n keys so non-EN PDFs get translated dividers (Premiers pas, Sécurité…),
matching the live sidebar. Adds the FR OPCP PDF alongside EN under static-pdfs/.
…resh command

- Serve PDFs from docs/public/pdfs/ (rspress publicDir) instead of a custom copy
  step, so they reach /pdfs/ regardless of the CDS build command (fixes the 404).
- Tag the FR OPCP landing page with pdf: (it lacked the button); button falls back
  to the EN PDF on locales without their own (de/es/it/pl/pt), never 404.
- Cover shows a localized generation date so a maintainer can compare it against the
  latest guide changes and know when to regenerate.
- pnpm pdf:refresh <ref> [locales] regenerates and drops PDFs straight into
  docs/public/pdfs/ (replaces the removed build:static-pdfs copy step).
The site is served under per-locale path prefixes (/en/, /fr/…) and docs/public/ is
copied into each locale's output, so the PDF lives at /<locale>/pdfs/<pdf-locale>/…,
not at the site root. The button linked to /pdfs/… → 404. Prefix the href with the
current locale (fixes the staging 404).
rspress copies docs/public/pdfs/ into every dist/<locale>/pdfs/. combine-builds now
moves one copy to the shared dist/pdfs/ and drops the per-locale duplicates (same
pattern as images), so PDFs are served from the root /pdfs/<locale>/… — a single
shared copy instead of one per locale. Reverts the previous per-locale link prefix.
Both /pdfs/en/… and /pdfs/fr/… survive; the button picks by page locale.
@Y0Coss Y0Coss added the DO NOT MERGE This PR should not be merged as long as this label is applied. label Jul 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

DO NOT MERGE This PR should not be merged as long as this label is applied.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant