Skip to content

fix(export): print an exported HTML file, with 1cm margins - #1033

Merged
PathGao merged 1 commit into
masterfrom
fix-export-print
Oct 26, 2026
Merged

PathGao merged 1 commit into
masterfrom
fix-export-print

Conversation

@PathGao

@PathGao PathGao commented Oct 26, 2026 •

Copy link
Copy Markdown
Collaborator

Printing an exported HTML file from a browser gave a blank page. The export copies the app's stylesheets, including the print block that hides everything outside #app (the PDF route prints #print-root inside it), and an exported file has no #app, so its article was hidden. Once shown, it also kept its 40px screen padding on paper.

The export now shows its article in print. One --page-margin in styles.css (1cm, which CSS draws as 37.8px on screen) is the padding of the app's PDF, of a printed export, and of an exported file on screen, so the file keeps its shape when printed. The print margin changes from 0.75in to 1cm, the margin Markdown tools commonly print with (the Markdown PDF extension for VS Code, Electron's print default used by Obsidian). The live preview's own padding is unchanged.

Verified: new scripts/export.spec.ts resolves the print and screen cascade in jsdom, each page in its own frame; it fails with the display rule removed, with the 40px padding back on paper, with 40px on screen, and with --page-margin missing. Full node/vitest suites and svelte-check green. A built export opened and printed in headless Chrome shows the article with the same 1cm margin on screen and on paper (before: a blank printed page, also on 231fe74).

Printing an exported HTML file from a browser gave a blank page. The export
copies the app's stylesheet, whose print block hides everything outside
#app, and an exported file has no #app. The export now shows its article on
paper and keeps its 40px padding to the screen, so paper gets the print
block's margins, which are 1cm for both the PDF route and an exported file.
@PathGao
PathGao merged commit a86821a into master Oct 26, 2026
4 checks passed
@PathGao
PathGao deleted the fix-export-print branch October 26, 2026 13:03
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