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

🖨️ Some PDF layout improvements #2738

Merged
merged 1 commit into from
Dec 6, 2023
Merged

Conversation

fonsp
Copy link
Owner

@fonsp fonsp commented Dec 6, 2023

Header positions

We now avoid a widow header, so there is a higher likelihood that a header will appear on the same page as the content it is a header to:

Screenshots are before & after

image

The level 1 header will always create a new page

image

Other page break changes

The <br> or --- horizontal rule will now act like a page break when creating a PDF

image

Before this PR, Pluto avoids all page breaks inside of a pluto-cell. I.e. if a cell (content + code (if not folded)) needs to be fragmented between pages, it will be moved to the next page.

This PR adds an exception for "prose cells": cells that contain mostly text. This means that cells that just contain a couple paragraphs are allowed to break inside. Here, you expect breaks inside, and it creates a less fragmented document overall.

image

Avoid empty final page

Made some changes that were sometimes causing an extra empty page at the end of the document.

image

Full before/after comparisons

I printed all the featured notebooks before and after:

before.zip

after.zip

Copy link
Contributor

github-actions bot commented Dec 6, 2023

Try this Pull Request!

Open Julia and type:

julia> import Pkg
julia> Pkg.activate(temp=true)
julia> Pkg.add(url="https://github.com/fonsp/Pluto.jl", rev="print-stylesheet-improvements")
julia> using Pluto

@fonsp fonsp merged commit b6998a3 into main Dec 6, 2023
4 checks passed
@fonsp fonsp deleted the print-stylesheet-improvements branch December 6, 2023 14:56
@fonsp fonsp added frontend Concerning the HTML editor publishing Notebooks as static documents on the web labels Dec 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
frontend Concerning the HTML editor publishing Notebooks as static documents on the web
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant