Paginated PDF output regularily ends a page with a heading.

Dieter Baron's Avatar

Dieter Baron

05 Jul, 2022 05:59 AM

// Please enter a detailed description of the issue // Description of the issue:

Paginated PDF output regularily ends a page with a heading.

// Please enter a list of steps required to reproduce the issue // Steps to reproduce:

  1. Write a longer Markdown document with multiple headings.
  2. Save it as paginated PDF.
  3. See that some headings are at the end of a page with the corresponding seciton beginning on the next.

// If applicable please attach a sample document that causes the issue for you.

// Configuration (do not edit) Marked 2 1031 (Mac App Store)

macOS Version: 12.4

allowPageBreakInCode: YES
bookTxtIsLeanpub: NO
summaryMdIsGitBook: NO
codeIsPoetry: NO
codeCanWrap: YES
collapsibleHeadlines: NO
convertGithubCheckboxes: YES
convertGithubEmoji: YES
convertYAMLToMMD: NO
defaultMathJaxConfig: TeX-AMS-MML_HTMLorMML
defaultPreviewStyle: 0
defaultProcessor: MultiMarkdown
enableMiniMap: NO
excludeBlockQuotesFromCounts: NO
excludeFootnotesFromCounts: NO
excludeVerbatimFromCounts: NO
excludeCaptionsFromCounts: NO
folderPreviewExtensionsArray: md, markdown, txt, mdown, html, opml
githubNewlines: YES
h1IsPageBreak: NO
h2IsPageBreak: NO
hrIsPageBreak: NO
includeMathJax: NO
includeKatex: NO
limitTextWidth: NO
mathNumberEquations: NO
mathNumberEquationsSide: 0
mathNumberEquationsAMSOnly: NO
minimalJavaScript: NO
permissionGranted: NO
printHeaderFirstPage: NO
printFooterFirstPage: NO
processHTMLFiles: YES
removeMetadataForPreview: NO
removeYAMLHeaders: NO
scrollToEdit: YES
shouldDetectCritic: YES
shouldHighlightMarkupErrors: NO
shouldLoadCritic: NO
syntaxHighlight: YES
syntaxHighlightOnlyLang: NO
useCustomMarkdownProcessor: NO
useCustomPreprocessor: NO
useFirstH1AsPrintTitle: YES

  1. Support Staff 1 Posted by Brett on 05 Jul, 2022 01:20 PM

    Brett's Avatar

    This isn't terribly avoidable. Marked is basically printing a web page to PDF, meaning any print directions are limited to what CSS WebKit understands. I can tell it to put a page break before every header, but that would cause a lot more disruption (though there's the option to do that with h1/h2). I could use JavaScript to group all headers with their next paragraph or list and then request no page break within that container, but again, that would lead to unpredictable results in areas where it currently lays out fine. It's not an easy problem to solve.


Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:


Already uploaded files

  • Joyride.pdf 69.6 KB

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac