DEVONthink Markdown Annotations with Highlights and CSS Stylesheets

Here are a couple of quick tips for DEVONthink markdown annotations using the Highlights PDF app, and CSS Stylesheets. 

Annotations with Highlights App for macOS and iOS

The new version of Highlights is by no means a complete app. The search functionality is basic, it cannot access a document outline and one of the best features from the previous version is gone 1. It’s also a comparatively pricey app. For all that, it has a few neat tricks that other PDF apps don’t have. One, it still writes annotations out into a neatly formatted markdown file with neat page links, however now it also automatically grabs metadata for journal articles to head up the annotations. It also does some impressive things with the OCR layer of a PDF, allowing smart copying of citations and extraction of tables — although to be honest this makes the lack of search functionality all the more surprising.

However, the next trick is where Highlights makes itself almost indispensable. With a single click it will export your annotations to your archive of choice, with a few pre-linked apps like Bear, Keep it, Quiver and so on, or direct to file for any other app. With all those apps the page numbers will appear as Highlights callback links, so when you click on the page number, as long as the original pdf is still available it will magically open on the right page.

For DEVONthink users the export is even better. Highlights comes with a DEVONthink script that will replace the page links with DEVONthink-links. If you keep your documents in DEVONthink, your exported annotations will be magically linked to the document in your database.

Highlights macOS Markdown Annotations
Highlights automatically extracts annotations to Markdown

 

Styling Annotations in DEVONthink with CSS

One of DEVONthink’s hidden features is the ability to add style sheets for markdown documents. If you know a bit of CSS you can create your own, as per the DEVONthink blog , or find more detail on the DEVONthink forum

If you’d rather grift a pre-made stylesheet, there is no better place than Brett’s Marked 2 Style Gallery. Or you can use his very handy StyleStealer Bookmarklet to grab the CSS from any site you like the look of. Incidentally, if you really want to dig into previewing markdown documents, Marked is the best tool bar none — it even works as a Pandoc processor. Marked 2 also comes with Setapp.

Once you have the stylesheet you want to use, link it via the DEVONthink settings and enjoy the new pretty look of your exported annotations and other markdown documents. The file path is hidden under the Media settings tab in DEVONthink preferences. Once you drop tyhe file in, all of your markdown documents will pick up the styling. This is how my markdown documents look in DEVONthink now: 

Note: For anyone wondering about this stylesheet, it’s called Avenue. Taken from the original Marked Gallery.

Smart Group for Annotations

 

Devonthink Annotations Smart Group
Devonthink Annotations Smart Group

 

This is a basic rule to collected all documents with annotations into a smart group. It has two parameters:

  1. Kind is PDF/PS
  2. Where PDF Annotations is not 0

This gatheres your annotated PFDs into a single group. From there I can simply open the document in Highlights and export the markdown document back into DEVONthink. The next step is to automate the process of updating the files when new annotations have been added. DEVONthink is designed to handle multiple copies of documents, so this requores some lateral thinking, stay tuned for an update on that.

  1. In the original app you could edit the annotations markdown file like it was a note