Skip to content

Commit

Permalink
Merge pull request #1485 from Evian-Zhang/add-pagebreak
Browse files Browse the repository at this point in the history
Add page-break
  • Loading branch information
ehuss authored Mar 17, 2021
2 parents 536873c + 0eb23ef commit e6568a7
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/renderer/html_handlebars/hbs_renderer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ impl HtmlHandlebars {
ctx.html_config.curly_quotes,
Some(&path),
);
if !ctx.is_index {
// Add page break between chapters
// See https://developer.mozilla.org/en-US/docs/Web/CSS/break-before and https://developer.mozilla.org/en-US/docs/Web/CSS/page-break-before
// Add both two CSS properties because of the compatibility issue
print_content.push_str(r#"<div id="chapter_begin" style="break-before: page; page-break-before: always;"></div>"#);
}
print_content.push_str(&fixed_content);

// Update the context with data for this file
Expand Down

0 comments on commit e6568a7

Please sign in to comment.