Skip to content

Instantly share code, notes, and snippets.

@mikepqr
Last active September 27, 2021 04:19
Show Gist options
  • Save mikepqr/3042d8c3e7da25907c5ce623c8e2b129 to your computer and use it in GitHub Desktop.
Save mikepqr/3042d8c3e7da25907c5ce623c8e2b129 to your computer and use it in GitHub Desktop.
Make printouts from Firefox Reader mode look like NYRB artices

printout with this stylesheet

See this tweet for how I use this.

To install in Firefox:

  1. If it doesn't already exist, create a folder called chrome in your profile folder. The easiest way to find your profile folder is in about:profiles (there's a "Show in Finder" link for the folder on macOS). Be sure to choose the right profile is you have more than one.

  2. Put userContent.css above in the chrome folder you just created.

  3. Load about:config in Firefox then set toolkit.legacyUserProfileCustomizations.stylesheets to true.

  4. Quit and reopen Firefox, just for luck.

Then to use the stylesheet, activate Reader View (cmd-alt-R on macOS, other there's a button in the location bar), and then print the page. The printout will look roughly like an NYRB page.

/* NYRB-style print layout */
@media print {
@-moz-document url-prefix("about:reader") {
body, p, div {
font-family: 'Times New Roman' !important;
font-size: 11pt !important;
line-height: 13pt !important;
}
h1, h2, h3, h4, h5, h6 {
line-height: 100%;
}
body {
columns: 2 !important; /* 2 may look better on A4 */
color: black !important;
margin: 0 !important;
padding: 0 !important;
hyphens: auto !important; /* only works if document sets, e.g. lang="en" */
}
p {
margin: 0 !important;
padding: 0 !important;
text-indent: 1em !important;
text-align: justify !important;
}
p:first-of-type, h2+p {
text-indent: 0 !important;
}
article {
font-size: 10pt !important;
line-height: 10pt !important;
}
/* figure, img { */
/* display: none !important; */
/* } */
sup {
vertical-align: super !important;
line-height: 0.5em !important;
}
h2, h3, h4, h5, h6 {
margin: 0 !important;
padding: 0 !important;
}
blockquote {
margin: 1em 0 1em 0 !important;
padding: 0 0 0 0.5em !important;
font-size: 9pt !important;
border: none !important;
}
header {
font-style: italic !important;
margin: 0 0 1em 0 !important;
padding: 0 !important;
}
hr:first-of-type {
display: none !important;
}
a:link, a:visited {
color: inherit !important;
border: none !important;
text-decoration: underline !important;
text-decoration-color: #ccc !important;
}
.reader-estimated-time {
display: none !important;
}
.reader-toolbar {
display: none !important;
}
ul, ol {
display: block !important;
list-style: disc outside none !important;
margin: 1em 0 !important;
padding: 0 0 0 40px !important;
}
li {
display: list-item !important;
margin: 0 !important;
padding: 0 !important;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment