Skip to content

Commit

Permalink
Add print styles
Browse files Browse the repository at this point in the history
  • Loading branch information
solarkraft committed Oct 22, 2021
1 parent 8a6645a commit 77cdf8c
Show file tree
Hide file tree
Showing 3 changed files with 100 additions and 1 deletion.
45 changes: 45 additions & 0 deletions assets/css/doku.css
Original file line number Diff line number Diff line change
Expand Up @@ -25210,6 +25210,51 @@ a :active, a :focus, a .active {
opacity: 1;
}

@media print {
.argon-doku-page-menu, .ct-sidebar, footer, header {
display: none;
}

a:link:not(.media), a:visited:not(.media),
#dokuwiki__content .wikilink2 {
color: unset;
}
a:link:not(.media)::after, a:visited:not(.media)::after,
#dokuwiki__content .wikilink2::after {
content: " (" attr(href) ")";
font-size: 0.7em;
}

body a:not(.btn):not(button):not(.toggleAssistant):not(.qq-upload-button):not(.qq-upload-button):not(.toggleAssistant):not(button) {
text-decoration: none;
}

main hr {
display: none;
}

main.dokuwiki {
padding: 0 !important;
}

body {
margin-top: 2rem;
min-width: 0 !important;
color: black;
}

@page {
margin: 1cm;
margin-left: 2cm;
}
.media, .row, main {
display: unset;
}

p, span, img, h1, h2, h3, h4, h5, h6, a {
page-break-inside: avoid;
}
}
.user_info {
padding: 0 1rem;
font-size: 0.9em;
Expand Down
2 changes: 1 addition & 1 deletion assets/css/doku.css.map

Large diffs are not rendered by default.

54 changes: 54 additions & 0 deletions assets/css/doku.scss
Original file line number Diff line number Diff line change
Expand Up @@ -1114,6 +1114,60 @@ a {
// }
}

// ------ Printing ------

@media print {
// Hide everything that doesn't belong on paper
.argon-doku-page-menu, .ct-sidebar, footer, header {
display: none;
}

// Display their destinations behind links
a:link:not(.media), a:visited:not(.media), /* avoid images */
#dokuwiki__content .wikilink2 /* broken links */, {
color: unset; // Don't show link color since we can't click them anway
&::after {
content: " (" attr(href) ")"; // In turn show where the link leads
font-size: 0.7em;
}
}

// Argon can be annoying
body a:not(.btn):not(.qq-upload-button):not(.toggleAssistant):not(button) {
text-decoration: none; // DokuWiki shows a subtle border instead
}

// Remove usual margins/paddings
main hr { display: none; }
main.dokuwiki {
padding: 0 !important; // This barely overrides argon's CSS ...
}

// Re-add margin to top
body {
margin-top: 2rem;
min-width: 0 !important; // STFU Argon
color: black;
}

// Use page margins (show up on pages individually)
@page {
margin: 1cm;
margin-left: 2cm;
}

// Remove all flex elements to make page-break-inside work
// https://stackoverflow.com/questions/7706504/page-break-inside-doesnt-work-in-chrome/12386608#comment96041791_12386608
.media, .row, main {
display: unset;
}

// Avoid page breaks within elements
p, span, img, h1, h2, h3, h4, h5, h6, a {
page-break-inside: avoid;
}
}

// User menu

// User info in drop down when a user is logged in
Expand Down

0 comments on commit 77cdf8c

Please sign in to comment.