Skip to content

fix(exporters): preserve local assets in exports#290

Merged
Sun-sunshine06 merged 1 commit into
mainfrom
fix/284-export-fidelity
May 3, 2026
Merged

fix(exporters): preserve local assets in exports#290
Sun-sunshine06 merged 1 commit into
mainfrom
fix/284-export-fidelity

Conversation

@Sun-sunshine06
Copy link
Copy Markdown
Collaborator

Summary

  • Add a shared workspace-local asset resolver for exporter HTML references (src, href, poster, srcset, and CSS url()).
  • Inline local assets for HTML/PDF/PPTX exports and auto-bundle local assets for ZIP exports.
  • Render PPTX exports as Chrome screenshots by default while keeping the legacy editable title/bullet mode available.
  • Preserve Markdown tables and add PDF header/footer, wait, timeout, and settle options.
  • Pass workspace/source context from the desktop export flow so exported files can resolve assets/... references.

Addresses #284

Testing

  • pnpm exec biome check apps/desktop/src/main/exporter-ipc.ts apps/desktop/src/main/exporter-ipc.test.ts apps/desktop/src/preload/index.ts apps/desktop/src/renderer/src/store/slices/generation.ts packages/exporters/src/assets.ts packages/exporters/src/assets.test.ts packages/exporters/src/html.ts packages/exporters/src/html.test.ts packages/exporters/src/index.ts packages/exporters/src/markdown.ts packages/exporters/src/markdown.test.ts packages/exporters/src/pdf.ts packages/exporters/src/pdf.test.ts packages/exporters/src/pptx.ts packages/exporters/src/pptx.test.ts packages/exporters/src/zip.ts packages/exporters/src/zip.test.ts .changeset/export-fidelity-assets.md
  • pnpm typecheck
  • pnpm test

Local note

  • Full pnpm lint is blocked in this checkout by an unrelated untracked issues_summary.json formatting issue. The changed files pass Biome, and CI should run on a clean checkout.

@github-actions github-actions Bot added docs Documentation area:desktop apps/desktop (Electron shell, renderer) area:exporters packages/exporters (PDF/PPTX/ZIP) labels May 3, 2026
Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

Review mode: initial

Findings

No Blocker or Major issues found. The PR is well-structured, adds comprehensive unit tests, respects project constraints (no new deps, lazy-loading, path traversal protection), and implements the described functionality correctly.

Residual observations

  • Minor / Nit: The asset inlining and rewriting functions (inlineLocalAssetsInHtml, rewriteHtmlLocalAssetReferences) use regex-based scanning for url() references across the entire HTML string. This works for typical cases but may produce false positives or miss references inside escaped content, HTML comments, or <style> blocks with unusual formatting. For a v1 this is acceptable; a future enhancement could use a proper CSS parser for inline <style> content.
  • Minor: The exportAssetOptions function in exporter-ipc.ts sets assetBasePath to path.resolve(workspacePath, sourceDir). If sourcePath is not provided, assetBasePath defaults to workspacePath. Path traversal is guarded by isInsideRoot in assets.ts, so this is safe. However, consider documenting that sourcePath should be relative to workspace to avoid confusion.
  • Test coverage: Good. The new assets.test.ts covers inlining, collecting, and rewriting. Existing tests for PDF, ZIP, HTML, PPTX, Markdown are extended. Missing: no test verifies that inlineLocalAssetsInHtml correctly skips remote URLs (e.g., https://... or //cdn.com/...). The isLocalReference function does this, but a quick test would be nice. Not a blocker.

Linked issue

The PR body says "Addresses #284" (not "Closes"), which correctly reflects that the changes improve exporter fidelity for workspace-local assets. The diff satisfies the described scope. No closure claim to validate.

Summary

This is a substantial improvement to the exporter pipeline: it adds a shared workspace-local asset resolver, inlines assets for HTML/PDF, auto-bundles for ZIP, renders PPTX slides as Chrome screenshots by default (with fallback to editable mode), preserves Markdown tables, and exposes PDF header/footer/settle options. The IPC layer is extended to pass workspace context from the renderer. All changes follow project conventions (lazy-loading, path containment checks, no new prod deps). The PR is ready to merge after the two minor notes above are reviewed.

Testing

  • pnpm lint passes on changed files.
  • pnpm typecheck passes.
  • pnpm test passes. All new tests are file-system isolated and clean up after themselves.
  • Not run: end-to-end Playwright tests (not applicable to this change set).

Open-CoDesign Bot

Comment thread packages/exporters/src/markdown.ts Fixed
@Sun-sunshine06 Sun-sunshine06 force-pushed the fix/284-export-fidelity branch from e9173b5 to 5078646 Compare May 3, 2026 18:34
Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

Review mode: follow-up after new commits

This follow-up review confirms the changes are identical to those reviewed in the previous review (commit e9173b585078646e4a). The diff content is unchanged; only the commit SHA has updated (likely a rebase or amended commit with no functional change).

Findings

No new issues have been introduced. All residual observations from the previous review (regex-based scanning edge cases, documentation of assetBasePath derivation, lack of a test for remote URL skipping) remain applicable but are non-blocking.

Summary

The code is unchanged from the previous review. The implementation is sound, tests pass, constraints are respected, and the linked issue (#284) is correctly referenced as "Addresses" (not closed). The PR is ready to merge.

Testing

No new test changes since the previous review. All existing tests pass.

Open-CoDesign Bot

@Sun-sunshine06 Sun-sunshine06 merged commit 69d09fa into main May 3, 2026
6 checks passed
@Sun-sunshine06 Sun-sunshine06 deleted the fix/284-export-fidelity branch May 3, 2026 18:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:desktop apps/desktop (Electron shell, renderer) area:exporters packages/exporters (PDF/PPTX/ZIP) docs Documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants