Marked 2, Big Sur, and blurry PDFs
Ok, so here’s the deal. Marked works on Big Sur. If you’re using it for previewing your Markdown or exporting HTML, it should continue to work perfectly for you. But if you, like a majority of my customers, use Marked to output great-looking PDFs, you’re going to run into some trouble that will take me a while to sort out.
The short story is this: on Big Sur, for whatever reason, generating PDFs using WebKit outputs a raster image rather than a vector PDF as it has always done in the past. This means it can’t be zoomed, text isn’t selectable, and it’s basically a useless PDF. The workaround is simply to export to HTML, load it in Safari, and then print to PDF. You can get even better results using Firefox, but I’ll be posting a knowledge base article on that. You’ll lose some of Marked’s more advanced export features, but you’ll get a nice vector PDF out of it.
Allow me to explain a little further why this isn’t working, and why I’m not prepared for the release of Big Sur today.
When I first tested on Big Sur months ago, this problem became apparent. I filed bug reports and posted to forums but apparently I was the only person seeing this. This is mostly because the version of WebKit that Marked uses was deprecated a while ago, and most people had moved on to using the newer WKWebView. This wasn’t an option for Marked at the time, though, as WKWebView completely lacked printing and PDF capabilities until recently.
Switching to WKWebView meant major changes to Marked. I mean a complete rewrite of thousands of lines of code. And because the process meant losing major export functionality (among other losses), there was no justification for doing it. Zero. So I hoped that this PDF bug would be fixed and I wouldn’t have to make the switch until WKWebView was actually suitable for use.
WKWebView has finally added some of the features I need, though implemented in such a way that I still can’t fully replicate the functionality Marked had with the older WebView. And if I implement the latest features, it risks becoming incompatible with older macOS versions, meaning I’d have to have two entirely different apps available if I wanted to maintain customers who, for various reasons, haven’t chosen to update their OS. Which isn’t a trivial number these days.
After spending days and weeks on workarounds, I’ve come down to completely bypassing WebKit for the PDF export functionality. It’s still a major rewrite, and the available functionality, especially around customizable headers and footers, will change, but it should allow me to continue offering solid PDF export across OS versions. It will also significantly improve DOCX export. There will be a loss of ability to use custom themes for exported documents, but I’ll be working to allow PDF and DOCX custom themes once I get the basic functionality (re)implemented.
To summarize: if you update to Big Sur right now, your PDF exports from Marked 2 will be ruined. I’m working on the issue, but there are major changes coming that may take me months to implement. The HTML-to-web-browser solution should get you through, though, so it shouldn’t be a showstopper on updating your system.