Files
mattermost/docs/pdf
Eva SarafianouandCursor f3849f83de docs: fix broken path links, anchors, and tab rendering from RST-to-MDX migration (#37433)
* docs: resolve cross-file anchor mismatches from RST-to-MDX migration

The Sphinx-to-Docusaurus migration converted `:ref:`/`{ref}` links using
naive text-slugification, so anchors that pointed to headings in a
different file (e.g. release-summary tables linking into their
respective changelog pages) were emitted as same-page fragments and
silently resolved to nothing.

Built a label registry from the original Sphinx `.. _label:` / `(label)=`
targets to recover the true source file for each cross-reference, then
rewrote the affected links to point at the correct file + heading
anchor. Fixes 282 broken cross-file anchors, primarily in the mobile/
desktop/server release-summary pages, plus assorted same-page anchor
mismatches caught by re-auditing after the prior admonition/anchor fix.

Co-authored-by: Cursor <cursoragent@cursor.com>

* docs: manually resolve remaining anchor mismatches after cross-file audit

Hand-verified fixes for anchors that fuzzy-matching alone couldn't
safely resolve (confirmed against actual heading text/context, and in a
few cases against the original RST source, before applying):

- Typos and dropped words carried over from the original Sphinx docs
  (e.g. "bot-acocunts", "auto-follow-all-new-channel-threads" ->
  "follow-all-new-channel-threads").
- Sphinx auto-generated duplicate-heading IDs (#id1/#id3/#id4) resolved
  to their real target headings.
- Numbered-step TOC links in enterprise-roll-out-checklist.mdx that
  dropped the leading "N. " used in the actual heading slugs.
- Push-notification docs pointing at the wrong file entirely
  (environment-configuration-settings instead of
  push-notification-server-configuration-settings).
- SAML "saml-enterprise" label resolved to its true cross-file target
  (authentication-configuration-settings#saml-2-0), recovered from the
  original RST label definition that the automated registry missed
  because it sat after an RST transition marker.
- sso-saml-technical references converted from broken same-page/
  malformed-path anchors to correct page links.

Co-authored-by: Cursor <cursoragent@cursor.com>

* docs: fix SAML 2.0 anchor slug (saml-2-0 -> saml-20)

github-slugger strips periods rather than hyphenating them, so "SAML
2.0" slugifies to saml-20, not saml-2-0 as previously fixed.

Co-authored-by: Cursor <cursoragent@cursor.com>

* docs: fix broken path links found during docs/main migration cleanup

Co-authored-by: Cursor <cursoragent@cursor.com>

* docs: convert div.tab blocks to Docusaurus Tabs/TabItem components

Co-authored-by: Cursor <cursoragent@cursor.com>

* docs: restore missing Kubernetes deployment architecture diagrams

The RST-to-MDX migration never copied over the AWS/Azure/Oracle
architecture diagrams referenced by the deployment-architecture-at-scale
page, leaving broken images in each Tabs/TabItem.

Co-authored-by: Cursor <cursoragent@cursor.com>

* docs: fix 7 anchor mismatches from the fragment/heading audit

Covers three root causes from the anchor mismatch breakdown:
- Fragment repeated the target page's own title instead of a real
  heading, so the link is simplified to point at the bare page.
- Heading exists verbatim but lives on a sibling settings page
  (experimental-configuration-settings, push-notification-server-
  configuration-settings) rather than environment-configuration-settings.
- A page path was mistakenly pasted into a same-page #fragment instead
  of being used as a real cross-page link.

Co-authored-by: Cursor <cursoragent@cursor.com>

* docs: fix 8 anchor slugs that were close but didn't match the real heading

Repoints links whose fragment was a plausible guess (typo, reworded
heading, or wrong section) at the actual auto-generated slug of the
target heading, confirmed by inspecting each target page directly.

Co-authored-by: Cursor <cursoragent@cursor.com>

* docs: merge split Tabs blocks so tabs render horizontally

The div.tab conversion script split some sibling tab groups into
separate single-item Tabs blocks whenever a stray blockquote marker
sat between them, causing them to render stacked instead of as one
horizontal tab bar. Merges the MySQL/PostgreSQL and Team/Enterprise
Edition tab groups back into single Tabs blocks.

Co-authored-by: Cursor <cursoragent@cursor.com>

* docs: remove Azure tab and restore Kubernetes deploy content

The Mattermost Operator, Azure, and Oracle platform tabs on the
Kubernetes deployment guide were split across two separate Tabs
blocks (rendering stacked instead of as one tab bar) and all three
tab bodies were empty because the migration never flattened the
original RST include directives. Removes the unsupported Azure tab
and restores the Mattermost Operator and Oracle content from the
pre-migration RST sources as a single merged Tabs block.

Co-authored-by: Cursor <cursoragent@cursor.com>

* addresscoderabbitreview

* docs: unify Linux/Kubernetes/Containers deploy pages and fix FIPS/STIG placement

Kubernetes and Containers duplicated full install content across a top-level
page (Tabs) and orphaned sidebar subpages that nothing linked to. Reworked
both to follow the Linux page's pattern: shared content on the landing page,
platform-specific instructions live once in their own subpage.

Also removed configure-fips-at-install-time.mdx, which claimed FIPS is
available for native Linux installs — FIPS/STIG in Mattermost is a container
image property (Chainguard-based build), not available outside Docker/
Kubernetes. Consolidated all FIPS/STIG references onto
containers/fips-stig.mdx and pointed the Mattermost Operator subpage (not
Oracle OKE, which doesn't expose image selection) at it.

Co-authored-by: Cursor <cursoragent@cursor.com>

* docs: fix review findings — image alt text, Important callout markup, typo

- Replace generic alt="image" on scaling diagrams with descriptive text
  identifying cloud provider and user scale.
- Convert raw div.important markup in deploy-containers.mdx to the
  repo's <Important> component, matching usage elsewhere in the file.
- Fix "Matermost" typo in manage-your-display-options.mdx.

Co-authored-by: Cursor <cursoragent@cursor.com>

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-10 14:50:13 +03:00
..

Phase 2 — PDF pipeline

Builds brand-aligned PDF books from the docs site using headless Chromium + a print-only stylesheet.

What's here

pdf/
├── books/                    # Spine config: ordered list of URLs per book
│   └── api.json
├── scripts/
│   ├── build-page-pdf.mjs    # Capture a single page → PDF (the on-demand primitive)
│   └── build-book-pdf.mjs    # Concatenate a section's pages → branded book PDF
├── styles/
│   └── print.css             # Brand-aligned print stylesheet (cover, headers, page numbers)
├── build/                    # Output (gitignored)
└── package.json              # Puppeteer

Pipeline

docs site (npm start | npm run serve)
        │
        │ HTTP fetches per spine entry
        ▼
build-book-pdf.mjs
        │
        ├── fetches each <article> via Puppeteer page navigation
        ├── prepends a brand-aligned cover (denim + marigold + Mission in Motion)
        ├── composes static HTML, includes Google Fonts + the docs site's bundled CSS
        ├── overrides everything for paper via styles/print.css (only thing the print pass cares about)
        ▼
Puppeteer page.pdf({ format: 'A4', preferCSSPageSize: true })
        │
        ▼
build/mattermost-api.pdf

The print stylesheet does:

  • @page rules for A4 size, margins, and running headers/footers
  • string-set: chapter content() on h1 → fed into @top-right for chapter names
  • counter(page) " / " counter(pages) in @bottom-right for page numbers
  • Hides every site-chrome element (navbar, sidebar, footer, breadcrumbs, edit-this-page, OpenAPI right panel)
  • Brand-aligned typography (Archivo Black headlines, Inter body, JetBrains Mono code)
  • Page-break controls (page-break-before: always on h1, page-break-inside: avoid on figures/code/tables)
  • Print-mode treatments for every branded MDX component (Hero flattens, Callouts get a thin denim left bar, StatStrip becomes a 4-up grid, CardGrid becomes a list)

Usage

Single-page (on-demand) PDF

# Pre-req: docs site is running on port 3000 (npm start in docs-site/)
node pdf/scripts/build-page-pdf.mjs http://localhost:3000/api pdf/build/api-overview.pdf

Suitable as the unit primitive for the eventual "Download PDF" button on every page (CF Worker calls this against the production URL).

Multi-page book

node pdf/scripts/build-book-pdf.mjs --book api
# → pdf/build/mattermost-api.pdf

Spine controlled by pdf/books/api.json — add/remove URL paths to change what's in the book. Future work auto-generates the spine from the OpenAPI tag list.

Current state

Capability Status
Single-page PDF capture ✓ Working
Multi-page book with cover ✓ Working
Brand-aligned cover (denim + marigold + Mission in Motion + version + date) ✓ Working
Running header (chapter name on right) ✓ Working
Running footer (page X / N) ✓ Working
Page-break-before on each chapter (h1) ✓ Working
Branded typography (Archivo Black headlines) ✓ Working
Branded MDX components in print mode ✓ Working
Coming in v1.1 / future
Auto-generated TOC with page numbers Needs Paged.js (target-counter) — see §below
Cross-reference page numbers ("see chapter X on page N") Needs Paged.js
Watermarked customer PDFs (per-buyer "Provided to …") CF Worker injecting watermark via page.evaluate before page.pdf
Auto-generated index Needs Paged.js + index plugin
All sections, all versions (per PLAN.md §6.1) Needs spine generators per OpenAPI / per RST tree

Paged.js — when to add

Puppeteer's native page.pdf() covers the basic book layout (cover, headers, footers, page breaks) using just @page rules. We use that today.

Paged.js adds:

  • TOC generation via target-counter() (the printed page number a heading lands on)
  • "Continued on page N" bridges
  • Automatic figure / table cross-references
  • Better break-balancing across columns

Add Paged.js when we hit a real need for any of those — likely Phase 5 (main docs migration, where the admin guide is 100+ pages and a good TOC matters more). For now, the cover + chapter breaks + page numbers are sufficient.

To add: load pagedjs from npm or CDN, mount it via Paged.Previewer().preview(content, stylesheets, container) before calling page.pdf.

On-demand Worker (deferred)

The on-demand per-page "Download PDF" button (PLAN.md §6.2) is the same build-page-pdf.mjs primitive, hosted on a Cloudflare Worker:

User clicks "Download PDF" on /docs/11.0/admin/saml-config
                ▼
CF Worker /api/pdf?url=…
                ▼
Browser Rendering API loads the URL, applies print.css, returns PDF stream
                ▼
Worker streams PDF back with Content-Disposition: attachment

This is straightforward to add once production is up (Browser Rendering API needs a domain). Defer to Phase 6 (cut first release branch) or later.

Costs

Local: free. Headless Chromium runs on your machine.

Production (CF Browser Rendering API): ~$0.0010.005 per render. At 1000 PDFs/day (per PLAN.md §6.2), ~$50150/mo.