diff --git a/md_pdf/assets/static/style.scss b/md_pdf/assets/static/style.scss index 2295a1b..904d81f 100644 --- a/md_pdf/assets/static/style.scss +++ b/md_pdf/assets/static/style.scss @@ -27,12 +27,21 @@ body.content { img { margin-top: $image-spacing; width: 100%; + page-break-after: avoid; } p.caption { margin: 1px 5px $image-spacing; padding: 0; font-style: italic; + page-break-before: avoid; } + .references-title { + page-break-after: avoid; + } + + h1, h2, h3, h4, h5, h6 { + page-break-after: avoid; + } } diff --git a/md_pdf/build/template.py b/md_pdf/build/template.py index b74a1d3..1802e41 100644 --- a/md_pdf/build/template.py +++ b/md_pdf/build/template.py @@ -12,6 +12,7 @@ def fix_references_title(content, config): reference_element = soup.find('div', class_='references') if reference_element is not None: title = soup.new_tag('h1') + title['class'] = 'references-title' title.string = "References" reference_element.insert_before(title) return soup.prettify()