Repository navigation
Conversation
…page The export prints A4 with 0.75in margins, leaving about 978px of printable height, but the stylesheet capped only width. A Mermaid diagram taller than that fit nowhere: `page-break-inside: avoid` kept the svg whole and the preceding heading's `page-break-after: avoid` dragged the heading onto the new page too, so the page they left behind came out fully blank -- and the diagram itself was clipped across the pages it spilled over. Cap svg and img height in the print block. Measured against the real print options with a 1500px-tall diagram behind a heading: before, 5 pages with the last blank and the diagram split across three; after, 2 pages, no blank, and both ends of the diagram present. Fixes stablyai#21310 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01T6zUCU6cyicLSBNzHWQnh4
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughThe export CSS now limits Priority: ➖ Normal Merge Risk: ⚪ Minimal · up to Exported diagrams are constrained to the printable height while preserving their proportions, reducing blank pages and clipping. No concrete merge-blocking risk remains. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: 80c6cbdb-30fc-46cd-86dc-9929ef3d0b3b
📒 Files selected for processing (2)
src/renderer/src/components/editor/export-css.tssrc/renderer/src/components/editor/markdown-export-html.test.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.
There was a problem hiding this comment.
ℹ️ No critical issues — minor suggestions inline.
Reviewed changes
- Print-only height cap for diagrams — adds
max-height: 90vhfor.orca-export-root img, .orca-export-root svginside@media printinexport-css.ts, so a diagram taller than the A4 page area scales down instead of overflowing and blanking the preceding page. - Regression test — asserts the
max-height: 90vhdeclaration is present after the@media printmarker in the generated export HTML.
ℹ️ Nitpicks
export-css.ts:147— the comment saysvhresolves to "the page box"; in paged media it resolves to the page area (page box minus margins). The arithmetic is right (90vh≈ 881px against a ~979px printable height), only the term is imprecise.markdown-export-html.test.ts:44—html.indexOf('max-height: 90vh') > html.indexOf('@media print')still passes if the@media printblock is removed entirely (indexOfreturns-1), and also for a rule placed after the block. Asserting against the extracted media-block substring would actually pin the print scope.- The blank-page mechanism this PR describes (a
page-break-inside: avoidblock taller than the page area, preceded by apage-break-after: avoidheading) also applies to tallpre/tableblocks, which remain uncapped. Worth a follow-up if that is in scope.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
- Add object-fit: contain to printed images and SVGs so a tall raster image with an explicit width scales proportionately rather than stretching. - Match rules directly within the @media print block in markdown export HTML unit tests to ensure assertions guard the print-only scope.
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
Reviewed the delta since the prior pullfrog review (e78d2d3 → afd441ce), three follow-ups to the print-media height cap.
- Comment terminology corrected —
export-css.tsnow statesvhresolves to the "page area" rather than the "page box". object-fit: containadded — the print rule for.orca-export-root img, .orca-export-root svgnow preserves aspect ratio for tall raster images with explicit widths that the height cap would otherwise stretch. It is inert for auto-width images (box already matches the intrinsic ratio) and for inline<svg>.- Test scope tightened — the regression test now extracts the
@media printblock and asserts both declarations live inside it, replacing theindexOfordering check that could pass with the block removed.
The prior inline thread on raster aspect-ratio distortion was replied to and resolved.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
Keep the existing copy button and annotation wrapper while checking the original HAST code class. This removes the extra empty page reproduced in Markdown Preview PDF export without shrinking labels. Credit gum798 for #21310 and #21377, innocarpe for #21328, and m13v for the label-readability review. The height-cap proposals were evaluated but this fix keeps the existing diagram sizing.
Keep the existing copy button and annotation wrapper while checking the original HAST code class. This removes the extra empty page reproduced in Markdown Preview PDF export without shrinking labels. Credit gum798 for #21310 and #21377, innocarpe for #21328, and m13v for the label-readability review. The height-cap proposals were evaluated but this fix keeps the existing diagram sizing.
* Render Mermaid Preview outside its code pre wrapper Keep the existing copy button and annotation wrapper while checking the original HAST code class. This removes the extra empty page reproduced in Markdown Preview PDF export without shrinking labels. Credit gum798 for #21310 and #21377, innocarpe for #21328, and m13v for the label-readability review. The height-cap proposals were evaluated but this fix keeps the existing diagram sizing. * fix(editor): keep a diagram's copy button beside its expand button Trim the wrapper test to the regression cases and mock the runtime target hook main now uses.
|
Thanks for this. The blank page before a tall Mermaid diagram was fixed in #25621 by removing the extra |
Keep the existing copy button and annotation wrapper while checking the original HAST code class. This removes the extra empty page reproduced in Markdown Preview PDF export without shrinking labels. Credit gum798 for stablyai#21310 and stablyai#21377, innocarpe for stablyai#21328, and m13v for the label-readability review. The height-cap proposals were evaluated but this fix keeps the existing diagram sizing.

ELI5
When exporting Markdown to PDF, really tall diagrams (like long flowcharts) no longer create completely blank pages right before them or get cut in half across multiple pages.
What Changed
max-width: 100%but no height constraint. When a diagram exceeded the printable height of a page (~978px for A4 with 0.75in margins),page-break-inside: avoidon<svg>andpage-break-after: avoidon the preceding heading pushed both onto a new page, leaving the preceding page completely empty. The diagram was also clipped and split across multiple pages.max-height: 90vhto.orca-export-root img, .orca-export-root svginside the@media printblock inexport-css.ts. In paged media (Chromium print),vhresolves to the page box. The 90vh ceiling leaves room for the heading and surrounding margins, scaling the diagram down cleanly onto a single page without blanking the preceding page.@media printso that oversized blocks scale proportionately within the paged layout box.Why
max-width: 100%was already present to handle wide diagrams; this adds the matching vertical constraint for tall diagrams.90vhuses Chromium's paged media viewport resolution, adapting cleanly to the page box.Linked Issue
Fixes #21310
Visual Proof
Measured with a real Electron
printToPDFtest harness using the app's exact export options (A4, 0.75in margins) with a 1500px-tall diagram placed immediately behind a heading:Testing
src/renderer/src/components/editor/markdown-export-html.test.tsverifying thatmax-height: 90vhis included inside@media print.pnpm test src/renderer/src/components/editor/markdown-export-html.test.ts— 5 tests passed.pnpm tc:web— clean.node config/scripts/check-changed-code-quality.mjs upstream/main— 0 findings across all scans (oxlint, design system, type-aware, casting SAFETY).AI Disclosure
Co-authored with Claude Opus 5 and Antigravity (Gemini).
Checklist
pnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)