Formatting notes
Unlike metadata and annotations, Zotero notes can't offer much for custom formatting. If that is important to you, perhaps consider using Zotero 6 and its annotation features.
Limitations
The Zotero API returns notes as a block of HTML code:
If your note contains multiple highlights, comments, or complex formatting (headers, lists, etc), several steps are needed to properly import it to Roam:
Separating the note into blocks
Getting this right is very dependent on how your Zotero notes are created (manually or via plugins like Zotfile).
The extension uses the newline character,
\n
, as the default separator, but you can change this in your user settings if it doesn't work with your setup.If you use Zotfile to extract PDF highlights into Zotero notes, make sure to take a look at Zotfile's hidden settings, and adjust them to be compatible with the separator you choose in your zoteroRoam settings.
For example, if your Zotfile settings use
<p></p>
tags to surround comments and highlights, use</p>
or the "Paragraph" preset as your notes divider.
Removing the extra HTML markup, like
<div>
tagsThat's not easy to do in a comprehensive way, short of building a full HTML-to-Roam-Markdown converter - which is beyond the scope of the extension.
Feel free to create a GitHub issue for any markup that isn't supported by the extension's parser -- but be aware of the limitations presented here.
Converting meaningful HTML tags, like
<b>
, into Roam markupThis is the easy part!
With the above, currently the best option to work with Zotero notes is to use a tool like Zotfile, and tweak its formatting settings as well as the zoteroRoam separator so that they're compatible.
If you want more control over the output, and don't want to migrate to Zotero native annotations, you have the option of writing a custom JavaScript function to format your notes.
JavaScript template
If you decide to write your own parsing function, know that you'll have to clean all the HTML markup yourself. This is not recommended, due to the complexity involved, but this is supported.
Example
Write your function, with the syntax window.myParser = function(notes){...}
, and supply its name in your user settings.
Last updated