diff --git a/Cargo.lock b/Cargo.lock index a632711..f3e095b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2581,7 +2581,7 @@ dependencies = [ [[package]] name = "rustpad" -version = "0.2.74" +version = "0.2.75" dependencies = [ "argon2", "aws-config", diff --git a/Cargo.toml b/Cargo.toml index 850354a..c2faa0f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rustpad" -version = "0.2.74" +version = "0.2.75" edition = "2024" rust-version = "1.94" description = "Collaborative Markdown notepad built with Axum, WebSockets and SQLite, PostgreSQL and MySQL" diff --git a/static/js/pdf-export.js b/static/js/pdf-export.js index 7167675..9f0707e 100644 --- a/static/js/pdf-export.js +++ b/static/js/pdf-export.js @@ -530,12 +530,26 @@ function printStyles(cssSize, pageWidthMm, pageHeightMm, marginMm, preserveColor } .pdf-content .pdf-keep-unit { + /* + * Chromium can leave a 1-2 px fragment of an avoided block on the + * previous page before moving the real block to the next page. + * Making the keep unit an atomic inline-block prevents that ghost + * fragment while preserving book-like pagination. + */ + display: inline-block; + width: 100%; + vertical-align: top; + box-sizing: border-box; break-inside: avoid-page; page-break-inside: avoid; } .pdf-content .pdf-keep-unit > :first-child { margin-top: 0 !important; } .pdf-content .pdf-keep-unit > :last-child { margin-bottom: 0 !important; } .pdf-content .pdf-atomic-visual { + display: inline-block; + width: 100%; + vertical-align: top; + box-sizing: border-box; break-before: avoid-page; page-break-before: avoid; }