From 40fe48b75210a295c67b124a19306afcf4e856af Mon Sep 17 00:00:00 2001 From: Branimir Georgiev Date: Sun, 26 Apr 2026 15:13:17 +0300 Subject: [PATCH] feat: add print styles for chapters Hide nav, sidebars, FAB, and footer when printing. Prevent page breaks after headings and inside images. Wrap long code blocks. Closes #214 Co-Authored-By: Claude Opus 4.6 (1M context) --- astro-site/src/styles/global.css | 40 ++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/astro-site/src/styles/global.css b/astro-site/src/styles/global.css index 38c59f6..c45b78b 100644 --- a/astro-site/src/styles/global.css +++ b/astro-site/src/styles/global.css @@ -672,3 +672,43 @@ a:hover { padding: var(--space-lg) var(--space-md); } } + +@media print { + .site-header-bar, + .site-tabs-bar, + .sidebar-toc, + .sidebar-tutorials, + .resize-handle, + .mobile-toc, + .site-footer, + .skip-link { + display: none !important; + } + + .site-main { + display: block; + } + + .content { + padding: 0; + max-width: 100%; + } + + a { + color: inherit; + text-decoration: underline; + } + + pre { + white-space: pre-wrap; + border: 1px solid #ccc; + } + + img { + break-inside: avoid; + } + + h2, h3, h4 { + break-after: avoid; + } +}