Despite putting time into the replacement for nvALT, I also managed to get the latest update for Marked 2 out. My meds must be working. It’s available now on Setapp, direct (Check for Updates), and Mac App Store. It has a longer-than-usual list of improvements and fixes, so this post might get lengthy.

One area of focus was better support for Bear. If you want a true HTML preview with export options when using Bear, Marked is the perfect companion. Bear even offers a Note->Preview in Marked option. I get a lot of feedback from Bear users, so I put some extra time into polishing up compatibilities.

Better with Bear

Before I start talking too much about Bear, there’s one issue to note. Bear writes its preview files out to a system temp folder that Marked can’t permanently access from the sandboxed Mac App Store version, so users are constantly asked for permission. If you’re using Bear with the Mac App Store version of Marked, I offer a free crossgrade to the unsandboxed direct version. If you use the Help->Report an Issue feature and just send me the top part of the report section (above the ---), I’ll consider that enough proof to provide you with a license. You can also contact me through the support forum.

Anyway, this version of Marked takes care of a few Bear integration issues. First, when exporting a Bear preview to a PDF, the %title variable in headers and footers was using the UUID that Bear assigned to the note, which was an ungainly string of letters and numbers. That could definitely use some fixing.

Because every Bear note typically starts with an H1 used as the note title, I added an option to Export preferences to “Use first H1 as fallback title.” This applies to more than just Bear, since typically the fallback title was the filename unless a “title:” line was provided in metadata. Now if you don’t have metadata, you can have it automatically use the first H1 if one exists. It will still fall back to the source document’s filename if neither title metadata or H1 exist in the document.

If the preview is a Bear note, this feature also affects the window title and the filenames automatically assumed when exporting, so you get a file named after the title of the note instead of AD7BDC7A-DEE1-4ECA-A07E-0C202ED1B681-61957-0001952A65A19C70.html.

I also fixed Marked’s handling of relative image paths within the Bear TextBundle, so now images included directly in Bear notes will properly display in Marked and its various exports.

In Bear, you create tags with Twitter-style hashtags, #likethis. If these are at the beginning of a line, as is common, Markdown turns them into h1 headers, which is the most visually intrusive way possible to screw them up. So now, when previewing a Bear note, Marked will detect these tags and turn them into styled notations, which both improves aesthetics and completely avoids the accidental headlines. Marked supports #tag, #nested/tag, and #crazy weird! tag# formats. You can hide the display of Bear tags in Marked by turning off Gear Menu->Proofing->Show Comments.

Lastly, I made a Bear Custom Style, mostly on a whim. Grab it from the MarkedCustomStyles repository and add it to Marked using the Preferences->Style pane. For the full effect, go to Preferences->Style and “Limit text width in Preview” to about 450.

Scrivener, Too

There are a few improvements for Scrivener as well. Images referenced using Markdown syntax and a path relative to the base document will now display, and embedded image handling is improved.

There was an issue causing rendering to break on certain inline annotations that’s been resolved, and Marked does a better job of visually differentiating comments and inline annotations.

Like MathJax, but Faster

I’ve also added an option to use KaTeX instead of MathJax. It’s significantly faster for rendering large numbers of equations, and is only missing a few of MathJax’s advanced features. If you write with a lot of math, try it out and see if you can speed up your page renders.

Speaking of equations, I also made some modifications to allow better compatibility between the MultiMarkdown and Discount (GFM) processor options when dealing with MathJax (and KaTeX) syntax. It should be pretty transparent, whatever you use to delineate your equations should Just Work™ in both MMD and Discount modes.

Those Pandoc Crashes

There was an issue where errors generated when using Pandoc as a custom processor caused Marked to Just Crash™ rather than reporting the error gracefully. That’s fixed. It had nothing to do with Pandoc. It only had to do with calling an alert off the main thread. Facepalm.

Miscellaneous

One kind of random feature — the result of just two user requests but easy enough to implement — is page numbering offset (Preferences->Export). You can now have page numbering start at whatever number you like, so if you’re creating a title/cover page, including a long table of contents at the top, etc., you can adjust the page numbering to start on page 2, or 3, or whatever you need. It also accepts negative numbers, so ‘-1’ starts the page numbering at 2.

Paddle customers can now deactivate their licenses. Because Paddle limits by “activation” instead of by user or machine ids, every time you re-register Marked you use up an activation. I’ve always accommodated users by increasing their activation limits on request, but this will allow users to go ahead and deactivate a previous installation and recover the activation, whether they’re installing on a new/re-installed machine or transferring their license to another user. The license view also shows the activated license as selectable text, so it’s easier to copy out for safekeeping when needed.

Phew, that’s a pretty complete look at all the new stuff in Marked 2. You should definitely check it out.