Skip to content

Commit e6568a7

Browse files
authored
Merge pull request #1485 from Evian-Zhang/add-pagebreak
Add page-break
2 parents 536873c + 0eb23ef commit e6568a7

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/renderer/html_handlebars/hbs_renderer.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,12 @@ impl HtmlHandlebars {
4545
ctx.html_config.curly_quotes,
4646
Some(&path),
4747
);
48+
if !ctx.is_index {
49+
// Add page break between chapters
50+
// 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
51+
// Add both two CSS properties because of the compatibility issue
52+
print_content.push_str(r#"<div id="chapter_begin" style="break-before: page; page-break-before: always;"></div>"#);
53+
}
4854
print_content.push_str(&fixed_content);
4955

5056
// Update the context with data for this file

0 commit comments

Comments
 (0)