Skip to content

fix(export): render all diagrams in PDF and image output - #255

Merged
ThisIs-Developer merged 11 commits into
mainfrom
fix/render-diagrams-in-exports
Sep 2, 2026
Merged

fix(export): render all diagrams in PDF and image output#255
ThisIs-Developer merged 11 commits into
mainfrom
fix/render-diagrams-in-exports

Conversation

@ThisIs-Developer

@ThisIs-Developer ThisIs-Developer commented Sep 1, 2026

Copy link
Copy Markdown
Owner

What changed

  • route vector PDF, raster PDF, and PNG exports through one off-screen rich-content renderer
  • wait for Mermaid, ABC, PlantUML, D2, Graphviz, Vega-Lite, WaveDrom, Markmap, GeoJSON, TopoJSON, STL, math, fonts, and images before capture or print
  • freeze exported Markmap SVGs to tight tree bounds so print output remains full-size and readable
  • keep the chosen export theme scoped to the export snapshot so a dark export no longer turns the visible light app dark
  • prevent light print-media rules from overriding dark frontmatter tables, Mermaid diagrams, remote diagrams, maps, and other rich content
  • use a short, compact Appearance control while retaining the last choice for each export format
  • keep browser and desktop resources synchronized

Why

The raster export paths only re-rendered Mermaid, ABC, and math, so the remaining diagram engines were captured as loading placeholders. Browser-print export also changed the application theme while preparing a differently themed PDF, and late light print rules caused white tables and diagrams inside dark PDFs. Markmap additionally reused its interactive viewport transform in print, shrinking trees to a few pixels inside a large SVG.

How it was tested

  • npm test — 176 Chromium tests passed for the initial implementation
  • npx playwright test tests/e2e/export.spec.js tests/e2e/markmap-export.spec.js --project=chromium — export coverage passed
  • npx playwright test tests/e2e/rich-content.spec.js --project=chromium -g "renders Markmap" — live Markmap rendering passed
  • added regression coverage that verifies every supported diagram renderer is present in vector PDF, raster PDF, and PNG captures
  • added print-media coverage for dark tables, Mermaid colors, remote-diagram filters, app-shell hiding, and theme isolation
  • added a real-library Markmap print test with basic, deep-hierarchy, and large-architecture trees; each must occupy a readable share of its fitted SVG
  • visually checked the compact PDF Appearance control and live Markmap preview in the local app

Documentation

No public documentation changes are required; the export choices remain self-explanatory and continue to be remembered automatically.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Sep 1, 2026

Copy link
Copy Markdown

Deploying markdownviewer with  Cloudflare Pages  Cloudflare Pages

Latest commit: 723e763
Status: ✅  Deploy successful!
Preview URL: https://ab75e3e8.markdownviewer.pages.dev
Branch Preview URL: https://fix-render-diagrams-in-expor.markdownviewer.pages.dev

View logs

@vercel

vercel Bot commented Sep 1, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
markdown-viwer Ready Ready Preview Sep 2, 2026 11:32am UTC

@ThisIs-Developer
ThisIs-Developer force-pushed the fix/render-diagrams-in-exports branch from 6a9e577 to 981f3e7 Compare September 2, 2026 11:06
@ThisIs-Developer
ThisIs-Developer merged commit 41dd409 into main Sep 2, 2026
5 checks passed
@ThisIs-Developer
ThisIs-Developer deleted the fix/render-diagrams-in-exports branch September 2, 2026 11:39
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.

1 participant