Marked 3 print/PDF — large vertical gaps ("vertical justification") on under-full pages

Viewed 3

Long-time Marked user and fan here — it's been part of my daily writing workflow for years. After moving to Marked 3 I ran into a print/PDF template behaviour I wanted to document, in case others hit it too.

Environment: Marked 3.1.12, macOS, direct (non-MAS) build. Custom preview style based on Lopash. MultiMarkdown processor (though the behaviour below is the same across all four processors).

Main issue — content stretched vertically to fill under-full pages.
When a page doesn't fill completely, the paginator seems to distribute the content vertically to fill it: large gaps open up between blocks, and a heading can end up floated to the middle or bottom of an otherwise near-empty page — instead of the leftover whitespace simply falling at the bottom of the page.

  • It's most pronounced right before a heading that's followed by a large table.
  • Marked 2 doesn't do this (same document renders with normal bottom-of-page whitespace).
  • Adding manual <!--BREAK-->s makes it worse, not better — each break creates another partially-filled page for the effect to act on. (Measured on one ~9-page document: one targeted break helped, but a break before every top-level section took it to 13 pages with gaps up to ~580pt.)

Two smaller things noticed while tuning the custom print style:

  1. PDF export of a custom style appears to render in screen media — so @media print, page-break-*, orphans and widows rules in the stylesheet are ignored, and pagination can't be steered from CSS. (.mkprinting class rules do apply, which is how I styled everything else.)
  2. SVG diagrams exported from D2 / OmniGraffle (which use <foreignObject> and external font url()s) render blank when embedded via <img>; the PNG equivalents display fine.

None of this is urgent, and I remain a big fan — just wanted to pass it along in case it's useful. Happy to share a sample document or example exports. Thanks for making such a wonderful tool!

All the best,
Johan

0 Answers