Repository navigation
fix(export): print an exported HTML file, with 1cm margins - #1033
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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-rootinside 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-marginin 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).