Merge pull request #1485 from Evian-Zhang/add-pagebreak

Add page-break
This commit is contained in:
Eric Huss 2021-03-17 09:45:30 -07:00 committed by GitHub
commit e6568a70eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 0 deletions

View File

@ -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