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

Specifying print CSS rules for notebooks #11635

Merged
merged 1 commit into from
Dec 9, 2021

Conversation

SylvainCorlay
Copy link
Member

@SylvainCorlay SylvainCorlay commented Dec 8, 2021

References

This CSS change is meant to prevent page breaks in the middle of outputs when printing notebooks (webpdf export in nbconvert).

Code changes

Adding @media print CSS rules to:

  • hide collapsers
  • display the input wrappers and output wrapper with display: block (because flex prevents the use of break-inside CSS property in inner HTML).
  • set the break-inside property to avoid-page for jp-OutputArea-child elements.

Screenshots (Before | After)

before after

@jupyterlab-probot
Copy link

Thanks for making a pull request to jupyterlab!
To try out this branch on binder, follow this link: Binder

@jtpio jtpio added this to the 4.0 milestone Dec 8, 2021
@jtpio
Copy link
Member

jtpio commented Dec 8, 2021

Diff looks good, thanks!

Mind posting a quick screenshot of what it looks like when printed if you have one around? So we have it as reference here in this PR.

@SylvainCorlay
Copy link
Member Author

Diff looks good, thanks!

Mind posting a quick screenshot of what it looks like when printed if you have one around? So we have it as reference here in this PR.

I added a before / after screenshot going over several pages with bqplot figures.

@jtpio
Copy link
Member

jtpio commented Dec 9, 2021

Nice, thanks!

@github-actions
Copy link
Contributor

github-actions bot commented Dec 9, 2021

Benchmark report

The execution time (in milliseconds) are grouped by test file, test type and browser.
For each case, the following values are computed: min <- [1st quartile - median - 3rd quartile] -> max.

The mean relative comparison is computed with 95% confidence.

Results table
Test file large_code_notebook large_md_notebook
open
chromium
actual 5056 <- [5190 - 5267 - 5356] -> 6600 3391 <- [3564 - 3621 - 3668] -> 3836
expected 4944 <- [5152 - 5242 - 5334] -> 6477 3466 <- [3564 - 3635 - 3688] -> 3890
Mean relative change 1.1% ± 1.6% -0.5% ± 0.7%
switch-from
chromium
actual 607 <- [688 - 724 - 759] -> 965 506 <- [536 - 548 - 566] -> 761
expected 626 <- [697 - 730 - 753] -> 1083 493 <- [537 - 551 - 568] -> 604
Mean relative change -0.7% ± 2.5% 0.1% ± 1.4%
switch-to
chromium
actual 683 <- [740 - 772 - 804] -> 997 612 <- [629 - 637 - 660] -> 724
expected 672 <- [725 - 759 - 800] -> 938 606 <- [628 - 642 - 664] -> 701
Mean relative change 1.4% ± 2.1% -0.0% ± 1.1%
close
chromium
actual 596 <- [692 - 937 - 1168] -> 1583 503 <- [533 - 544 - 556] -> 590
expected 629 <- [708 - 1090 - 1143] -> 1571 501 <- [525 - 539 - 553] -> 588
Mean relative change -0.9% ± 7.7% 0.8% ± 1.0%

Changes are computed with expected as reference.

@jtpio jtpio merged commit 13886ab into jupyterlab:master Dec 9, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 10, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants