Bold text and list styling lost across page boundaries in PDF export

Viewed 29

Hi Brett, I'm seeing an issue where inline styling gets dropped when it falls on a page boundary during PDF export. e.g., ordered list numbering and bold also reset across breaks.

I've tried various CSS fixes in my custom style—overflow: visible on #wrapper, break-inside: avoid on inline elements, re-asserting font-weight: 700 !important on strong/b, CSS counters for <ol>—none of which make a difference. This makes sense given that Marked 3's PDF export uses its own renderer rather than WebKit's paged media, so @media print rules wouldn't apply.

Here's a link to a minimal test file, the resulting PDF, my custom CSS, and my config file. (For some reason, attaching the file didn't work.)

Happy to provide any other details. Thanks in advance.

1 Answers

Just a cursory test, but I think what you're running into is a lack of newline before a list starts. Some flavors like CommonMark deal with this better than other flavors, but in general you should always have a blank line before a list. Especially with the MMD and Discount processors, not having a blank line means the following lines just get counted as paragraphs, not list items.

That doesn't necessarily explain why you're losing bold, but testing with the default Swiss style after adding in the newlines, I was able to export to PDF and the lists look fine and the bold on Testing 4 came through fine. https://from.ttscoff.me/list_testing.pdf