-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Printable cheat sheet #2074
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Printable cheat sheet #2074
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
516db90
assets/sass: use correct filename suffix
dscho 46e1a99
Add a print-specific style sheet
dscho 1e46d9b
print: handle rounded borders correctly with multiple pages
dscho fc03d14
Show a different tagline for print media
dscho bf57087
Hide the dark mode button when printing
dscho 3ab9b56
Cheat Sheet: define font sizes relative to container, not root
dscho da54cb7
cheat-sheet: adjust the print style-sheet
dscho 10264d4
Add a script to convert HTML to PDF
dscho 67b1ad4
html-to-pdf: optionally insert PDF link
dscho 498ebe4
html-to-pdf: deal with HUGO_RELATIVEURLS=false
dscho a760a01
html-to-pdf: work around minified `application.{css,js}`
dscho 96253af
html-to-pdf: optionally start Chromium with DevTools
dscho 98628ba
deploy/ci: render the cheat sheet as PDF and offer a link to it
dscho 70d379f
html-to-pdf: put the cheat sheet on 2 pages
jvns File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,153 @@ | ||
@media print { | ||
.inner { | ||
// The `position` of the `inner` class is defined as `relative`, which | ||
// causes funny issues when printing, for example tens of empty pages in | ||
// the middle. Let's suppress that. | ||
position: inherit; | ||
|
||
width: inherit; | ||
margin-bottom: 0; | ||
} | ||
|
||
#main { | ||
margin-bottom: 0; | ||
|
||
/* Improve readability */ | ||
line-height: 1.4; | ||
text-align: justify; | ||
|
||
/* Ensure it uses full page width */ | ||
width: 100%; | ||
border: none; | ||
padding: 0; | ||
} | ||
|
||
footer { | ||
display: none; | ||
} | ||
|
||
aside, .sidebar-btn, #search-container, #reference-version, #dark-mode-button, .site-source { | ||
display: none; | ||
} | ||
|
||
section { | ||
break-inside: avoid-page; | ||
} | ||
|
||
div#main { | ||
box-decoration-break: clone; | ||
} | ||
|
||
.pdf-link, #dark-mode-button { | ||
display: none !important; | ||
} | ||
|
||
.cheat-sheet { | ||
font-size: 8pt; | ||
|
||
section { | ||
border: 1px solid black; | ||
display: block; | ||
gap: 0; | ||
margin-bottom: 8px; | ||
padding: 8px; | ||
|
||
.item { | ||
background: none; | ||
border: none; | ||
|
||
h3 { | ||
margin-bottom: 0; | ||
} | ||
|
||
code { | ||
background: none; | ||
line-height: inherit; | ||
padding: 1px; | ||
display: block; | ||
margin-bottom: 2px; | ||
} | ||
} | ||
} | ||
.commit-reference { | ||
background: none; | ||
border-left: 1px solid black; | ||
|
||
dl { | ||
gap: inherit; | ||
|
||
dt,dt::before,dd { | ||
line-height: inherit; | ||
font-size: 0.7em !important; | ||
} | ||
} | ||
} | ||
|
||
p { | ||
font-size: inherit; | ||
line-height: inherit; | ||
margin: 1px; | ||
} | ||
} | ||
} | ||
|
||
@media print and (min-width: 231mm) { | ||
div#content { | ||
width: 297mm; | ||
} | ||
|
||
header { | ||
padding: 0; | ||
#logo img { | ||
max-height: 23px; | ||
width: auto; | ||
height: auto; | ||
} | ||
} | ||
|
||
/* landscape orientation */ | ||
@page { | ||
size: A4 landscape; | ||
width: 297mm; | ||
height: 210mm; | ||
margin: 1cm; | ||
} | ||
|
||
.cheat-sheet { | ||
/* Multi-column layout */ | ||
column-count: 4; | ||
column-gap: 1em; | ||
margin-top: 20px; | ||
|
||
h1 { | ||
column-span: all; | ||
position: absolute; | ||
top: -10px; | ||
width: 100%; | ||
font-size: 16px; | ||
text-align: center; | ||
} | ||
|
||
div.item { | ||
display: block; | ||
width: 100%; | ||
padding: 1px; | ||
margin-bottom: 1px; | ||
break-inside: avoid; | ||
|
||
label { | ||
margin-top: 2px; | ||
} | ||
} | ||
|
||
/* Manual column break controls */ | ||
.print-break-before { | ||
break-before: column; | ||
} | ||
} | ||
} | ||
|
||
div#main .pdf-link img { | ||
float: right; | ||
height: 36px; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -113,7 +113,7 @@ <h3>Commit all unstaged changes:</h3> | |
</div> | ||
</section> | ||
|
||
<section> | ||
<section class="print-break-before"> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice! |
||
<h2 id="move-between-branches">Move Between Branches</h2> | ||
<div class="item"> | ||
<h3>Switch branches:</h3> | ||
|
@@ -181,7 +181,7 @@ <h3>Show a summary of a diff:</h3> | |
<code>git show <commit> --stat</code> | ||
</div> | ||
</section> | ||
<section class="commit-reference"> | ||
<section class="commit-reference print-break-before"> | ||
<h2 id="ways-to-refer-to-a-commit">Ways to refer to a commit</h2> | ||
<p class="intro"> | ||
Every time we say <code><commit></code>, you can use any of these: | ||
|
@@ -236,7 +236,7 @@ <h3>'Stash' all staged and unstaged changes:</h3> | |
</div> | ||
</section> | ||
|
||
<section> | ||
<section class="print-break-before"> | ||
<h2 id="edit-history">Edit History</h2> | ||
<div class="item"> | ||
<h3>"Undo" the most recent commit (keep your working directory the same):</h3> | ||
|
@@ -285,7 +285,7 @@ <h3>Show who last changed each line of a file:</h3> | |
</div> | ||
</section> | ||
|
||
<section> | ||
<section class="print-break-before"> | ||
<h2 id="combine-diverged-branches">Combine Diverged Branches</h2> | ||
<div class="item"> | ||
<h3>Combine with rebase:</h3> | ||
|
@@ -695,7 +695,7 @@ <h2 id="add-a-remote">Add a Remote</h2> | |
</div> | ||
</section> | ||
|
||
<section> | ||
<section class="print-break-before"> | ||
<h2 id="push-your-changes">Push Your Changes</h2> | ||
<div class="item"> | ||
<h3>Push the <code>main</code> branch to the remote <code>origin</code>:</h3> | ||
|
@@ -757,7 +757,7 @@ <h3>See all possible config options:</h3> | |
</div> | ||
</section> | ||
|
||
<section> | ||
<section class="print-break-before"> | ||
<h2 id="important-files">Important Files</h2> | ||
<div class="item"> | ||
<h3>Local git config:</h3> | ||
|
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how do you think about putting this code in the print stylesheet vs the
cheat-sheet.scss
style sheet?I had a similar question about dark mode stuff -- for me if I'm editing the "cheat sheet" page it feels easier if all of the CSS for that page (dark mode, print, etc) are in the same place. But I think there are some advantages to having a "dark mode" or "print" stylesheet that have all of the dark mode print settings that I'm not thinking of.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it makes sense to me to move the cheat-sheet specific stuff into
cheat-sheet.scss
, and leave the generic print-related stuff inprint.scss
.