This is an old revision of the document!


Note Templates

This is draft documentation for the new PDF reader and note editor in Zotero 6, currently in beta.

Annotations

You can use note templates to customize how PDF annotations are added to notes. To view the available templates, go to the Advanced pane of the Zotero preferences, open the Config Editor, and search for annotations.noteTemplates. There are currently three available templates: for highlight annotations, for note annotations, and for the title of notes created from all of an item's annotation.

Templates support basic HTML, with variables within curly brackets. Here's the default template for highlights:

<p>{{highlight quotes='true'}} {{citation}} {{comment}}</p>

You can see that, by default, highlight annotations are added as a single paragraph, with the highlighted text in typographic quotes followed by the citation and any comment.

If you prefer to have the highlight text in a blockquote, it's a simple change:

<blockquote>{{highlight}}</blockquote><p>{{citation}} {{comment}}</p>

Conditionals

Templates also support conditionals. Rather than combining the citation and comment in a single paragraph as in the previous example, you might want to create a separate paragraph for the comment, but only if a comment actually exists. You can test whether a variable is set with a simple if:

<blockquote>{{highlight}}</blockquote><p>{{citation}}</p>{{if comment}}<p>{{comment}}</p>{{endif}}

Conditionals can also be used to test for specific values. Here, text highlighted in red becomes a header, text highlighted in blue becomes a blockquote, and all other highlights use a single paragraph:

{{if color == '#ff6666'}}
	<h2>{{highlight}}</h2>
{{elseif color == '#2ea8e5'}}
	{{if comment}}<p>{{comment}}:</p>{{endif}}<blockquote>{{highlight}}</blockquote><p>{{citation}}</p>
{{else}}
	<p>{{highlight quotes='true'}} {{citation}} {{comment}}{{if tags}} #{{tags join=' #'}}{{endif}}</p>
{{endif}}

Variables

Here are the available variables and their supported parameters:

  • highlight
    • quotes (boolean)
  • citation
  • comment
  • color
  • tags
    • join (string)
note_templates.1645508732.txt.gz ยท Last modified: 2022/02/22 00:45 by dstillman