Skip to content

feat: export note as self-contained HTML file - #75

Draft
adam4813 with Copilot wants to merge 2 commits into
mainfrom
copilot/export-html-interface
Draft

feat: export note as self-contained HTML file#75
adam4813 with Copilot wants to merge 2 commits into
mainfrom
copilot/export-html-interface

Conversation

Copilot AI commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Adds an HTML export feature that captures the rendered view of a markdown note and produces a portable, self-contained .html file. Images are fetched and inlined as base64 data URLs so the export works offline with no external dependencies. PDF export is available via browser print → Save as PDF with no additional work.

Changes

apps/web/src/lib/export-html.ts — new utility

  • inlineImages(html) — parses rendered HTML, replaces <img src> URLs with base64 data URLs; skips existing data: URLs and silently tolerates fetch failures
  • buildHtmlDocument(title, body) — wraps body HTML in a complete HTML5 document with an embedded typography stylesheet
  • exportAsHtml(element, title) — orchestrates the pipeline and triggers a browser <a download> click

apps/web/src/components/mode-toggle.tsx

Adds optional onExportHtml prop; renders an "Export HTML" button in the floating toolbar when provided (matches existing sync-scroll button style).

apps/web/src/components/note-editor.tsx

Adds handleExportHtml that queries .rendered-scroll within regionRef and calls exportAsHtml. Passed to ModeToggle only when showRendered && noteRenderer — the button only appears when the rendered pane is actually visible.

apps/web/src/styles.css

Adds .mode-export-btn style consistent with .mode-sync-toggle.

Copilot AI linked an issue Aug 28, 2026 that may be closed by this pull request
- Add export-html.ts utility: inlineImages, buildHtmlDocument, exportAsHtml
- Add Export HTML button to ModeToggle (shown in rendered/split modes)
- Wire handleExportHtml in NoteEditor via regionRef querySelector
- Add .mode-export-btn CSS (matches existing mode-sync-toggle style)
- Add unit tests for buildHtmlDocument

Closes #52

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI changed the title [WIP] Add export interface for HTML output feat: export note as self-contained HTML file Aug 28, 2026
Copilot AI requested a review from adam4813 August 28, 2026 02:22
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.

Export

2 participants