From e6f9b5b68e570ac9159f93b947b82e5887b99b77 Mon Sep 17 00:00:00 2001 From: NukDokPlex Date: Tue, 30 Jan 2024 10:58:10 +0500 Subject: [PATCH 1/2] feat: add print mode style tweaks --- _sass/layout/post.scss | 48 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/_sass/layout/post.scss b/_sass/layout/post.scss index efbde822686..42788c0a436 100644 --- a/_sass/layout/post.scss +++ b/_sass/layout/post.scss @@ -355,3 +355,51 @@ h1 + .post-meta { margin-right: -0.5rem; } } + +/* --- Print Mode, remove unnecessary and annoying elements for printing --- */ + +@media print { + #topbar-wrapper { + display: none; + } /* hide topbar */ + + main { + padding: 0px; + } /* remove paddings from page - they are replaced by paper margins in print */ + + main h1 { + margin-top: 0px; + } /* remove title's top margin - it's replaced by paper margins */ + + .post-tail-wrapper { + margin-top: 10px; + } + + .embed-video { + display: none; + } /* printers can't print videos, for now */ + + #related-posts { + display: none; + } /* you don't need related posts on paper */ + + .share-wrapper { + display: none !important; + } /* for some reason the buttons printed on paper don't work */ + + .code-header button { + display: none; + } /* remove copy code button */ + + div[class^="language-"] .code-header::before{ + display: none !important; + } /* remove dots from code highlight windows */ + + .post-navigation { + display: none !important; + } + + footer { + margin-top: 0px !important; + } +} From 029865e34ff99f578f3755a4d0be0ea7b0bf73dd Mon Sep 17 00:00:00 2001 From: NukDokPlex Date: Tue, 30 Jan 2024 11:18:05 +0500 Subject: [PATCH 2/2] fix: remove units and replace margin of post-tail-wrapper with 0 --- _sass/layout/post.scss | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/_sass/layout/post.scss b/_sass/layout/post.scss index 42788c0a436..d75bc35eae2 100644 --- a/_sass/layout/post.scss +++ b/_sass/layout/post.scss @@ -364,15 +364,15 @@ h1 + .post-meta { } /* hide topbar */ main { - padding: 0px; + padding: 0; } /* remove paddings from page - they are replaced by paper margins in print */ main h1 { - margin-top: 0px; + margin-top: 0; } /* remove title's top margin - it's replaced by paper margins */ .post-tail-wrapper { - margin-top: 10px; + margin-top: 0; } .embed-video { @@ -400,6 +400,6 @@ h1 + .post-meta { } footer { - margin-top: 0px !important; + margin-top: 0 !important; } }