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

Viewed 9

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

That’s great, thank you. I think a lot of these issues go away when I switch to CommonMark.

I actually used to use a post-processor that inserted a newline (since I personally prefer to not add a newline—or lazy about—before a list), but this beta version doesn't seem to allow me to run scripts, or maybe I’m missing something.

So I was just waiting until the official version (to be downloaded not from the App Store but from the official Marked website, which was the case for Marked 2). But I should ask since I have you here — is there a way to run an external script with this beta version?

See Settings>Processor>Custom Rules. There's a VERY elaborate system for running multiple scripts based on criteria and I'd love it if you tested it out.

The rules are stored in a .dat file that will be easily portable to the direct-purchase version when it's available (and it will be, at the same time the MAS version launches).