Skip to content

feat(files): add Markdown PDF export - #6504

Closed
BillLeoutsakosvl346 wants to merge 3 commits into
stagingfrom
feat/markdown-pdf-export
Closed

feat(files): add Markdown PDF export#6504
BillLeoutsakosvl346 wants to merge 3 commits into
stagingfrom
feat/markdown-pdf-export

Conversation

@BillLeoutsakosvl346

Copy link
Copy Markdown
Contributor

Summary

Adds a browser-native Save as PDF… action for open Markdown files.

  • Keeps the existing Download action unchanged and places the Markdown-only PDF action directly after it
  • Reuses the rendered rich Markdown editor and window.print() with the file name as the temporary document title
  • Applies scoped print styling for a light, paginated document while hiding application and collaboration chrome
  • Adds no dependencies, API routes, server-side generation, or shared component changes

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation
  • Other

Testing

Automated checks:

  • bunx biome check --no-errors-on-unmatched --files-ignore-unknown=true on the three changed files
  • cd apps/sim && bun run type-check
  • git diff --check

Local smoke checks:

  • Confirmed the localhost app responds successfully on port 3000
  • Self-reviewed Markdown-only gating, action ordering, title restoration, and isolation of the existing Download, Share, and Delete handlers

A dedicated button-level test was intentionally not added because equivalent Files header actions do not have button-level tests. Browser print-preview testing and screenshots were not available from this session because no controllable browser was attached. Reviewers should manually verify dialog cancellation, suggested filename, both app themes, non-Markdown gating, and a multi-page document with headings, lists, code, tables, links, and images.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing (not added; rationale above)
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

Screenshots/Videos

Not available from this session; browser automation reported no attached browser.

@vercel

vercel Bot commented Aug 10, 2026

Copy link
Copy Markdown

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

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Aug 10, 2026 11:07pm

Request Review

@cursor

cursor Bot commented Aug 10, 2026

Copy link
Copy Markdown

PR Summary

Low Risk
Client-only print/export with DOM cleanup; no auth, persistence, or API changes. Residual risk is print-preview quirks across browsers and themes, not data or security.

Overview
Adds a Save as PDF… action for open Markdown files in the Files header (right after Download), using the browser print dialog with no new server or dependencies.

The rich Markdown editor reports when its content is loaded and safe to print; the action stays disabled until the current file is ready. Export marks the editor root with print attributes, temporarily sets document.title from the file name (extension stripped), calls window.print(), and restores title and DOM flags on afterprint or error.

Scoped @media print rules hide app and collaboration UI and style the active markdown surface as a light, paginated document (typography, code blocks, tables, images).

Reviewed by Cursor Bugbot for commit da78a4b. Bugbot is set up for automated code reviews on this repo. Configure here.

@greptile-apps

greptile-apps Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Adds browser-native PDF export for open Markdown files by marking the active rich editor as the print root and invoking the browser print dialog.

  • Adds a Markdown-only “Save as PDF…” file action.
  • Temporarily scopes printing to the selected editor and restores document state after printing.
  • Adds light-theme, paginated print styling for Markdown content.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
apps/sim/app/workspace/[workspaceId]/files/components/file-viewer/rich-markdown-editor/rich-markdown-editor.css Adds scoped print rules and now preserves the hidden state of the inactive editor surface.
apps/sim/app/workspace/[workspaceId]/files/components/file-viewer/rich-markdown-editor/rich-markdown-editor.tsx Marks each loaded rich Markdown editor with a file-specific print-root attribute.
apps/sim/app/workspace/[workspaceId]/files/files.tsx Adds the Markdown-only PDF action and manages print scoping, title restoration, and cleanup.

Reviews (2): Last reviewed commit: "fix(files): scope Markdown print styles" | Re-trigger Greptile

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using high effort and found 3 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Want reviews to match your repository better? Bugbot Learning can learn team-specific rules from PR activity. A team admin can enable Learning in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit a7a306a. Configure here.

Comment thread apps/sim/app/workspace/[workspaceId]/files/files.tsx
@BillLeoutsakosvl346

Copy link
Copy Markdown
Contributor Author

@greptile

@BillLeoutsakosvl346

Copy link
Copy Markdown
Contributor Author

Closing as superseded. The replacement will implement direct Markdown-to-PDF generation and download instead of browser print preview.

@waleedlatif1
waleedlatif1 deleted the feat/markdown-pdf-export branch August 10, 2026 23:44
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