Skip to content

Commit d5b44c6

Browse files
author
Bittor Alaña
committed
Definitively fix blank page issues
Introduce a slightly altered version of the old page break logic, but with a small tweak so that the `avoid` only applies to the very first page, and not to nested sections. Thus there is no page break before the TOC, but there is always a page break before a section, even when nested.
1 parent 1f34cb6 commit d5b44c6

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/mkdocs_print_site_plugin/css/print-site.css

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,12 @@ Print site table of contents styling
9696
#print-page-toc { display: block }
9797

9898
/* PDF page breaks on each MkDocs page, except the first one */
99-
#print-site-page section.print-page:not(:has(> #print-page-toc)) {
99+
#print-site-page section.print-page {
100100
page-break-before: always;
101101
}
102+
#print-site-page > section.print-page:first-of-type {
103+
page-break-before: avoid;
104+
}
102105

103106
/* PDF page breaks - separate title page for each section */
104107
#print-site-page section.print-page.md-section > h1 {

0 commit comments

Comments
 (0)