Skip to content

Instantly share code, notes, and snippets.

@encukou
Created May 13, 2024 08:57
Show Gist options
  • Save encukou/400de604a37d4e6cd204f459ca2fc224 to your computer and use it in GitHub Desktop.
Save encukou/400de604a37d4e6cd204f459ca2fc224 to your computer and use it in GitHub Desktop.

A printer-friendly style for the PyCon US 24 schedule pages, taken from Hugo's blog post.

Paste the following into the browser console. (You might get a warning about not pasting code you don't understand -- it's there for the same reasons why I don't like installing browser extensions that someone recommends to me.)

The style will only change when you print (or do a print preview).

var sheet = document.createElement("style");
sheet.innerHTML = `
  @media print {
      body div.internal-page-header,
      body div.panel-heading,
      body footer,
      body div.badges {
        display: none;
      }

      body .container {
        margin: 0;
        max-width: fit-content;
      }
      body main.content {
        margin: 0;
        width: 100% !important;
      }
      body .calendar {
        left: auto !important;
        width: 100% !important;
      }
      body .slot {
        padding: 5px;
      }
      a:after { content:''; }
      a[href]:after { content: none !important; }
  }
`;
document.head.appendChild(sheet);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment