-
Notifications
You must be signed in to change notification settings - Fork 18
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
TOC Tree Fix and Page Break Handling for document handling #82
Comments
The following code shows the enumeration of the headings and the use of them in the css.
This would ensure to properly identify the headings in css and handle the prage-breaks properly As an example my custom css for page page handling
|
reply to @danwos comments: #61 (comment) to have all in this new issue The main issue for me here is to have e.g. identical layouts in css files of same types, i.e. all of my "Online" help files (help.css) or my specification documents (specification.css). I would not like to rely on the content and there for a generic id for the first header in the body would help me to adress this correctly. If i would require individual, content based identifiers i would use css selectors from section.ids > h2 or something like that. The sections have ids with content dependent ids. As i stated above, this could maybe also done via other methods, but all of my tries with selectors More or less important is to "revert" the #61 cause this breaks the tocs and get weasyprint warnings due to unresolved anchors. But reverting "without" any other changes would lead to the original problem again. |
Good point.
|
id or classes i don't care, i am no html expert which could start a discussion of what is better/semantical correct. Headings with even/odd may help for two page layout. So ok, i would implement it as classes. |
During merging those several PR's something went wrong in conflict resolving. There are missing two lines from the original fix. I open a new PR to include this again |
related last commit is 5991ed4. Issue could now be closed. Improvement / Wishes could be to extend this to more than h1, h2 levels. Maybe this should not be "hardcoded", maybe this should be configurable or just applied to ALL headers. Waiting for feature request 😄 |
Ok, I close this issue. Feel free to reopen if feature requests show up :) |
Issue #61 breaks some documents with following conditions:
So the fix breaks all documents there anchor and text do not match.
Intentionaly the fix tried to solve the issue that the first toctree entry points to the file itself, not to the first section in the file.
From Sphinx point of view this is ok, cause the file is not required to have an heading, but should appear in the toc.
In my opinion the fix could be also done by breaking the document after the body
Cause under some circumstances (cover page yes/no, sidebar yes/no) this could lead to additional blank pages due to h1/h2 page-breaks (from simplepdf's main.css).
Therefore following solution works for me:
<div class="body">
.For Step2 is was not able to identify the first h1 / h2 properly e.g. with
h2:first-of-type
or other selectors.Therefore i suggest do add a unique id to the first h1 / h2 elements in the body.
This is for handling the document page-breaks after toc/cover only.
Further h1 h2 elements are / should not be covered. Page breaking should then be done generally (like from main.css) or individual by adding page breaks in the rst document itself.
The text was updated successfully, but these errors were encountered: