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

Make page break behavior configurable #73

Open
JohannesHaag opened this issue Mar 15, 2023 · 2 comments
Open

Make page break behavior configurable #73

JohannesHaag opened this issue Mar 15, 2023 · 2 comments

Comments

@JohannesHaag
Copy link

Hello,

in our project documentation, we have often the case that a chapter has no content. For example if it is directly followed by a sub chapter or if the content is added at a later time. This results in a lot of nearly empty pages in the rendered PDF document.

As far as I have seen, there is no possibility to prevent sphinx-simplepdf from making page breaks in general, or to configure the level of chapters for which a page break should be done (eg only for the main chapters).

Maybe anyone has already a solution for this issue?
If there is no option for that at the moment, it would be really helpful, to introduce such a configuration option.

Thanks in advance for your feedback and support.

@kreuzberger
Copy link
Contributor

This could be configured via the css. In the main.css by default a page break is added before h1, h2 elements.
E.g. you can disable it for h2 elements. I see currently no possibility to make it "content" dependent.
You can also add classes and directives to force page breaks for e.g. specific (class) h2 elements etc.

My solution to have no page break between first (and only h1 chapter) and the "content" h2 chapters e.g. is:

/* no page break after first title */
h1 + section > h2 {
    page-break-before: avoid;
}

@kreuzberger
Copy link
Contributor

With #82 this could now be configured in "general" for headers with class attributes. Currently it is limited to h1/h2 headers.

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

No branches or pull requests

2 participants