From e230134f417c54087090797022313d30d233753c Mon Sep 17 00:00:00 2001 From: Roni Axelrad Date: Thu, 21 May 2026 08:54:22 -0400 Subject: [PATCH 1/2] fix: correct PDF export rendering bugs The exported PDF previously had three issues: - The first few characters of the first line were hidden behind the top-fade-mask gradient overlay. - The TOC overlay, TOC toggle button, and find bar (if open) were visible in the exported PDF. - Long lines inside code blocks were trimmed at the right edge because .viewer-content kept overflow: hidden during print, and the invalid `word-break: break-word` did not actually wrap long tokens. Extend the @media print block in styles.css to hide the overlays, release overflow on .viewer-content, and replace the bad word-break rule with overflow-wrap: anywhere on pre / pre code. --- src/styles.css | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/styles.css b/src/styles.css index 99b80e2..d4b29d9 100644 --- a/src/styles.css +++ b/src/styles.css @@ -1146,7 +1146,11 @@ body { .title-action-btn, .theme-dropdown-container, .control-btn, - .lang-label { + .lang-label, + .top-fade-mask, + .toc-overlay-wrapper, + .toc-toggle-floating, + .find-bar { display: none !important; } @@ -1155,7 +1159,8 @@ body { #app, .markdown-container, .layout-container, - .pane.viewer-pane { + .pane.viewer-pane, + .viewer-content { background: white !important; overflow: visible !important; height: auto !important; @@ -1179,10 +1184,12 @@ body { position: static !important; } - .markdown-body pre { + .markdown-body pre, + .markdown-body pre code { white-space: pre-wrap !important; - word-break: break-word !important; - overflow-x: visible !important; + overflow-wrap: anywhere !important; + word-break: normal !important; + overflow: visible !important; } .markdown-container { From 627f1948f35fbf1c6e0b7fced52669d88903f40e Mon Sep 17 00:00:00 2001 From: Roni Axelrad Date: Thu, 21 May 2026 08:54:49 -0400 Subject: [PATCH 2/2] fix: avoid awkward page breaks in PDF export Reduce content getting split unnaturally across pages in the exported PDF: - Headings get `break-after: avoid` so they no longer get stranded at the bottom of a page with their content on the next. - Code blocks, blockquotes, tables, figures, images, mermaid diagrams, and KaTeX displays get `break-inside: avoid` so they stay on one page when they fit. - Paragraphs and list items use `orphans: 3; widows: 3;` so prose can still split across pages but never with only one or two stranded lines at the top or bottom. Note: blocks taller than a single page will still split (the browser ignores break-inside in that case), but this fixes the common "first line of a paragraph alone at the bottom" pattern. --- src/styles.css | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/styles.css b/src/styles.css index d4b29d9..ca405e1 100644 --- a/src/styles.css +++ b/src/styles.css @@ -1192,6 +1192,32 @@ body { overflow: visible !important; } + .markdown-body p, + .markdown-body li { + orphans: 3; + widows: 3; + } + + .markdown-body h1, + .markdown-body h2, + .markdown-body h3, + .markdown-body h4, + .markdown-body h5, + .markdown-body h6 { + break-after: avoid; + break-inside: avoid; + } + + .markdown-body pre, + .markdown-body blockquote, + .markdown-body table, + .markdown-body figure, + .markdown-body img, + .markdown-body .mermaid-diagram, + .markdown-body .katex-display { + break-inside: avoid; + } + .markdown-container { zoom: 1 !important; }