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

Conversation

tbussmann
Copy link
Contributor

Avoid widows and orphans, page breaks after headlines (fixes #33)

Avoid widows and orphans, page breaks after headlines (fixes upstream iainc#33)
@antons
Copy link
Collaborator

antons commented Apr 25, 2020

Unfortunately, in our testing on macOS 10.15.4 this technique did not affect pagination in any way.

@tbussmann
Copy link
Contributor Author

I'm developing on 10.13.6 so I had to set up a VM with 10.15.4 to test. On first view I thought you were right and the change does not work in 10.15. But then I found out, it is the way of testing that leads to false negative results: Pressing cmd-shift-r does reload the template for the preview. While you can switch the developer tools to display and test the @media print styles, it does not allow show a paginated output. For this I used the actual print preview window. Unlike in 10.13, in 10.15 this does however always use the template as it was when the print window was opened for the first time. From then on it uses a cached version and you have to restart iA Writer for the changes to the template to be applied. Knowing that, I ran reconfirm that both the widows/orphans as well as the no-break-after-headline fix do work on 10.15 as they do on 10.13.

@tbussmann
Copy link
Contributor Author

tbussmann commented May 4, 2020

From then on it uses a cached version and you have to restart iA Writer for the changes to the template to be applied.

An easier way to refresh the print CSS is to switch to another template, briefly open the print window and switch back to the template you are developing on.

Copy link
Collaborator

@antons antons left a comment

Choose a reason for hiding this comment

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

Thank you for this pull request, and for thoroughly testing it. After more testing, I can confirm it works. I’m not sure what happened the last time we tested it, but we’re very happy that this long-standing problem can be resolved.

In addition to the change proposed in the comment on widows and orphans, I’d appreciate it if you could adjust the commit message with past tense, proper sentence capitalization, and a period at the end, following the style we use in this repo. After that, I‘ll merge the changes.

@@ -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;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

page-break avoid doesn’t work
2 participants