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

Merge HTML for PDF outputs #640

Merged
merged 41 commits into from
Nov 11, 2022
Merged

Merge HTML for PDF outputs #640

merged 41 commits into from
Nov 11, 2022

Conversation

arthurattwell
Copy link
Member

@arthurattwell arthurattwell commented Oct 16, 2022

This enables (by default) merging all of a book's HTML files into one for PDF output. This is an important step for various reasons:

  • We can now break chapters up into smaller markdown/HTML files, without that adding page-breaks in PDF output. Shorter pages are better for the web (more readable and probably more SEO-friendly).
  • It's a step towards being able to use PDF renderers like Antenna House and PagedJS, both of which require a single input HTML file.

This is a significant restructuring of our HTML, though, because we can no longer use the <body> element to store chapter-specific attributes. These are now moved to the .wrapper.

Also, it's important to never use IDs in CSS or Javascript that acts on the PDF after merging, because the merging process renames all IDs (to avoid duplicates in different chapters). It also renames all internal links accordingly.

Merging can be avoiding on output by adding --merged false to the output command, e.g. npm run eb -- output -f screen-pdf --merged false.

@arthurattwell arthurattwell merged commit da82526 into restructure-meta-text Nov 11, 2022
@arthurattwell arthurattwell deleted the merged-html branch November 11, 2022 09:53
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.

1 participant