Skip to content
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

improve pagination while printing #41

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 40 additions & 1 deletion GitHub.iatemplate/Contents/Resources/github.css
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,50 @@ html {
@media print {
.markdown-body {
--horizontal-padding: 75px;
widows: 2; /* avoid single lines at... */
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably be applied to p:

.markdown-body p {
  widows: 2;
  orphans: 2;
}

orphans: 2; /* ...begin and end of page */
}
.markdown-body pre code {
white-space: pre-wrap;
}
}

/* avoid page breaks after headlines */
.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4,
.markdown-body h5,
.markdown-body h6 {
/* this should be simple but due to WebKit bug https://bugs.webkit.org/show_bug.cgi?id=5097 it isn't:
page-break-after: avoid; /* old syntax, not working in webkit
break-after: avoid-page; /* new syntax, not implemented in webkit
instead, increase the calculated height of headlines by using an invisible element and forbid breaks within: */
page-break-inside: avoid;
}
.markdown-body h1::after,
.markdown-body h2::after,
.markdown-body h3::after,
.markdown-body h4::after,
.markdown-body h5::after,
.markdown-body h6::after {
content: "";
display: block;
height: 50px;
margin-bottom: -50px;
}
/* github-markdown.css does define bottom padding and border for h1 / h2 which conflicts with this hack
remove these and define them top of the workaround instead */
.markdown-body h1,
.markdown-body h2 {
padding-bottom: unset;
border-bottom: unset;
}
.markdown-body h1::after,
.markdown-body h2::after {
margin-top: 0.3em;
border-top: 1px solid #eaecef;
}
}

/* Fix for paragraph list items. GitHub embeds input into the first paragraph, iA Writer doesn’t. */
.markdown-body .task-list-item {
Expand Down