From 79cdeab80a6d318557cfe6252fd1ff7acf494c92 Mon Sep 17 00:00:00 2001 From: jinjoolee07 Date: Wed, 10 Jun 2026 15:37:29 +0900 Subject: [PATCH] Improve PDF content flow within chapters --- CHANGELOG.md | 7 +++++++ templates/api-reference/pdf/styles.scss | 28 +++++++++++++++++++++++++ templates/manual/pdf/styles.scss | 28 +++++++++++++++++++++++++ 3 files changed, 63 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1d7cb47..4e8c60a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,12 @@ This file documents recent notable changes to this project. The format of this file is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [Unreleased] + +### Changed + +- Improved generated PDF readability by reducing awkward page breaks, sparse pages, and layout issues around common documentation blocks. + ## [0.1.0] - 2026-03-30 ### Added @@ -29,4 +35,5 @@ this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Added release workflow to create GitHub Releases from tags using CHANGELOG.md. +[Unreleased]: https://github.com/aicers/docs-theme/compare/0.1.0...HEAD [0.1.0]: https://github.com/aicers/docs-theme/tree/0.1.0 diff --git a/templates/api-reference/pdf/styles.scss b/templates/api-reference/pdf/styles.scss index ec78d1c..07c6748 100644 --- a/templates/api-reference/pdf/styles.scss +++ b/templates/api-reference/pdf/styles.scss @@ -285,3 +285,31 @@ article#doc-toc li>a { display: inline-block; line-height: 0.5; } + +article:not(#doc-cover):not(#doc-toc) section + section { + break-before: auto !important; + page-break-before: auto !important; + min-height: auto !important; +} + +article:not(#doc-cover):not(#doc-toc) h2, +article:not(#doc-cover):not(#doc-toc) h3, +article:not(#doc-cover):not(#doc-toc) h4, +article:not(#doc-cover):not(#doc-toc) h5 { + break-after: avoid !important; + page-break-after: avoid !important; +} + +article:not(#doc-cover):not(#doc-toc) table, +article:not(#doc-cover):not(#doc-toc) pre, +article:not(#doc-cover):not(#doc-toc) blockquote, +article:not(#doc-cover):not(#doc-toc) ul, +article:not(#doc-cover):not(#doc-toc) ol, +article:not(#doc-cover):not(#doc-toc) div.highlight, +article:not(#doc-cover):not(#doc-toc) div.tabbed-content--wrap, +article:not(#doc-cover):not(#doc-toc) div.admonition { + break-before: auto !important; + page-break-before: auto !important; + break-inside: auto !important; + page-break-inside: auto !important; +} diff --git a/templates/manual/pdf/styles.scss b/templates/manual/pdf/styles.scss index ec78d1c..07c6748 100644 --- a/templates/manual/pdf/styles.scss +++ b/templates/manual/pdf/styles.scss @@ -285,3 +285,31 @@ article#doc-toc li>a { display: inline-block; line-height: 0.5; } + +article:not(#doc-cover):not(#doc-toc) section + section { + break-before: auto !important; + page-break-before: auto !important; + min-height: auto !important; +} + +article:not(#doc-cover):not(#doc-toc) h2, +article:not(#doc-cover):not(#doc-toc) h3, +article:not(#doc-cover):not(#doc-toc) h4, +article:not(#doc-cover):not(#doc-toc) h5 { + break-after: avoid !important; + page-break-after: avoid !important; +} + +article:not(#doc-cover):not(#doc-toc) table, +article:not(#doc-cover):not(#doc-toc) pre, +article:not(#doc-cover):not(#doc-toc) blockquote, +article:not(#doc-cover):not(#doc-toc) ul, +article:not(#doc-cover):not(#doc-toc) ol, +article:not(#doc-cover):not(#doc-toc) div.highlight, +article:not(#doc-cover):not(#doc-toc) div.tabbed-content--wrap, +article:not(#doc-cover):not(#doc-toc) div.admonition { + break-before: auto !important; + page-break-before: auto !important; + break-inside: auto !important; + page-break-inside: auto !important; +}