Available for beta testing: Note templates for PDF annotations

In the latest beta, we've added the ability to customize how PDF annotations are added to notes. See Note Templates for more info.

In addition to making it possible to change how annotations are displayed within Zotero notes, this should help with some of the workflows people have requested when using Markdown export. For example, if you adjust the template to place highlighted text within a blockquote, the exported Markdown will include > This is a quote as expected.

We'll be making refinements to the default templates and adding additional capabilities in future versions. If there are specific things you'd like to see, let us know.
«1
  • Great feature, I've managed to make a template that both looks good in the Note editor and fits into my Roam Research workflow with Markdown export.

    The only thing I haven't been able to do is to set the note title to be equal to parent item title. As far as I can tell, the {[title}} property is just "Annotations". This is important because when exporting to Markdown default filename is equal to note title.
  • Hello, this is pretty much right on the money on the post I just did (which is under review)

    I will try it and see how it works.

    Can this be extended to the way left pane annotations exports by drag and drop ?

  • Excellente fonctionnalité !

    Par contre, il y a quelque-chose que je ne comprends pas ou que je ne trouve pas.

    Avec Zotfile, on pouvait exporter les métadonnées (type de document, auteur, année..) et les notes.
    J'avais pris l'habitude d'exporter les notes et les infos dans deux fichiers .md, puis de les fusionner dans un obsidian.

    Je ne retrouve pas la fonction permettant d'exporter les métadonnées. J'ai vu qu'on peut imprimer un rapport, mais je n'ai pas trouvé la fonction pour l'exporter en markdown.

    Idée de ce qui faciliterait mon workflow :

    - Possibilité de créer un modèle commun qui intègre les métadonnéees en titre (clef de citation, type de document, auteur...)
    --> Via le menu "Ajouter une note" -> ajouter une note avec métadonnées

    Ou

    Exporter le rapport de document en markdown
  • This is a very welcome functionality... thank you so much!

    What I am missing is the possibility to give a formated text to the title as "Heading 4" (nor as h3). Btw, Zotero does not include the /h4 format.

    Normally, when creating a new note, and before including annotations, I write a first line to be the title of the note, but it does not apply the format type (Heading 4, in my case). I tried to modify the Template of the title, but it does not work.
  • @FabienGouez: It sounds like you may be thinking of the mdnotes plugin, not ZotFile. The functionality described here is more of a replacement for ZotFile's hidden settings for customizing extracted annotations, not for mdnotes's export templates (with item metadata, etc.). We added note Markdown export but don't have immediate plans to add export templates, so you'd have to ask the mdnotes developer to update their plugin for Zotero 6 if you want that.
  • @warguelles: I'm not sure what you mean here. The annotations.noteTemplates.title template is used when you create a note from all of an item's annotations, and using h3 or h4 works fine (the latter even though it's not an option in the formatting drop-down). If you're just talking about options when editing a note manually, that's unrelated to this functionality and you should start a new thread.
  • @dstillman Could something like the note templates be used for templates more broadly? For example, when I do systematic reviews, I usually write notes for (1) contact information for authors and information needed, and (2) coding decisions and justifications, with a fairly structured format. It would be awesome to be able to click a button and add one of these templates to the note.
  • @bwiernik: I don't see us adding that anytime soon, but a plugin could certainly do that easily.
  • This is a great new feature! I was just wondering what the HEX codes for the highlight colours might be, so that they can be referenced in conditionals? I understand from the examples that #ff6666 is the red, and #2ea8e5 is the blue.
  • @ccharlesa: I've added the color codes to the documentation. (You could also temporarily include the '{{color}}' variable as text to see.)
  • Thank you very much!
  • Hi dstillman, I found that I don't quite know how I should set up the template so that zotero makes the different highlight colors change to specific labels when exporting annotations. I can't figure out how to do it myself because I can't read the code very well. Is there a template I can refer to?
  • @Lizackery: The documentation includes an example of exactly what you were trying to do in your other thread. If there's something specific you can't figure out, post in that thread or start a new thread and explain where you're getting stuck.
  • edited March 7, 2022
    Maybe there're some bugs for (conditional) statement:

    1、『《h2》 {{highlight}}《/h2》』 : the link will be lost

    2、『{{if tags}} #{{tags join=' #'}}』:the '#' will be added to the note even though the tag is null
  • edited March 7, 2022
    Besides 『quote』for variable {{highlight}},are there other parameters such as 『bold』 for {{highlight}}? Thanks in advance.
  • Following on from my comment https://forums.zotero.org/discussion/94128/zotfile-no-option-to-extract-annotations, it would be amazing to have some more variables.

    https://www.zotero.org/support/note_templates says that there are {{highlight}}, {{citation}}, {{comment}}, {{color}}, {{tags}}.

    If I export markdown, I also get the various item keys:
    ([...](zotero://select/groups/123/items/AAA)) ([pdf](zotero://open-pdf/groups/123/items/BBB?page=1&annotation=CCC))

    It would be amazing to have these as variables: {{group_key}}, {{item_key}} (parent), {{file_key}}, and {{annotation_key}}.

    We'd also really like

    - {{user}}
    - {{created}}
    - {{edited}}
    - {{physical_page}}
    - {{logical_page}}

    I am not concerned whether the user is the user who edited last/created - any would be time. Same with time created and time edited: If it's available, we'll have it.

    Finally, I do think that some more colours would be good, as well as choice over the colours (that goes for the Zotero tag colours as well) - that's an accessibility thing too, and we'd love to be able to select our own friendly colours.

    The other thing that I would find amazing is if the template text could be copied straight from the note in the left panel of the PDF editor, using that template. We'd use that all the time when citing.
  • edited March 8, 2022
    @DigitalResearch:
    1、『《h2》 {{highlight}}《/h2》』 : the link will be lost
    The link is only present for highlights added to paragraph and blockquote nodes for now. Putting text in a header is more for a use case where you're highlighting headers in the PDF in a specific color to automatically create headers in the note, and treating those as annotations doesn't really make as much sense. Any actual annotations below the headers would be linked. But if there's demand for linking the headers too, we could consider it.
    2、『{{if tags}} #{{tags join=' #'}}』:the '#' will be added to the note even though the tag is null
    That's a bug. We'll fix — thanks.
    Besides 『quote』for variable {{highlight}},are there other parameters such as 『bold』 for {{highlight}}?
    Quotes are a variable because they're localized. If you want bold text, you can just use HTML.

    @bjohas:
    It would be amazing to have these as variables: {{group_key}}, {{item_key}} (parent), {{file_key}}, and {{annotation_key}}.
    We're not planning to add internal things like that as variables. This is an enhanced rich-text editor, and we think the appropriate place for internal keys is in the internal metadata. The built-in Markdown export will include them in the links it creates, and a plugin like zotero-mdnotes could use them to support additional workflows.
    - {{physical_page}}
    - {{logical_page}}
    The logical page is included in the citation, and the physical page is included in the metadata for use in the exported link.
    The other thing that I would find amazing is if the template text could be copied straight from the note in the left panel of the PDF editor, using that template.
    That's already supported in the latest beta.
  • I have the same question as @atomasevic is there a way to set the title to the entry title (or citekey, etc) by default instead of "Annotations"?
  • edited March 9, 2022
    @dstillman - thank you for the response!

    I'm on 6.0-beta.5+8b7afcf24. On the left panel, in the PDF editor, when I right-click on a note (or use the overflow), I get 'add to note', colours, 'edit page number', 'edit highlighted text', 'delete'. Should there be an export there?

    I hear what you are saying on {{group_key}}, {{item_key}} (parent), {{file_key}}, and {{annotation_key}}. However, .... we have open libraries, and we would want to change the link from zotero://select/groups/4578719/items/AFHQ3VQL to point to that open library, for example: https://www.zotero.org/groups/4578719/decolonising_edtech/items/AFHQ3VQL. We're also using Kerko (e.g., https://docs.opendeved.net/lib/ and https://docs.edtechhub.org/lib/) and have
    https://github.com/edtechhub/zotero-edtechhub to connect our libraries to kerko.

    Of course, we could set this up as a zotero-md workflow, but... we're looking at this for the 'average user' and being able to just copy-paste items straight from the note (or even better from the PDF editor) would be really really cool. For most [non-technical] people, exporting the note, then copying the text, is just too much effort for a regular workflow. So for us, being able to customise the template with {{group_key}}, {{item_key}} (parent), {{file_key}}, and {{annotation_key}} would be really really powerful.

  • On the left panel, in the PDF editor, when I right-click on a note (or use the overflow), I get 'add to note', colours, 'edit page number', 'edit highlighted text', 'delete'. Should there be an export there?
    @bjohas: Just select the annotation and press Cmd/Ctrl-C, or use Edit → Copy, or drag to a text field.
  • @atomasevic, @wdeb0:
    The only thing I haven't been able to do is to set the note title to be equal to parent item title.
    We can add that.
  • @dstillman, Thanks for your reply.
    Putting text in a header is more for a use case where you're highlighting headers in the PDF in a specific color to automatically create headers in the note...But if there's demand for linking the headers too, we could consider it.
    yes, it's just my use case and what I want to link
  • Hi, I'm supporting our users in using Zotero and https://docs.edtechhub.org. Like @bjohas said, exposing additional keys ({{group_key}}, {{item_key}} (parent), {{file_key}}, and {{annotation_key}}) would be very helpful to our users.
  • @DigitalResearch: We've fixed the 'tags' test in the latest beta.
  • @dstillman, the new template feature is awesome. And I find @bjohas' request for more variables very interesting. If templates also allowed custom links, one could obtain notes that would be usable outside of Zotero. That would allow additional ways of sharing content. Of course Zotero web or Kerko serving such customized links are good examples (Kerko developer here!), where exported content could be shared with a larger audience that has a web browser but not necessarily a Zotero install. But I can also imagine the additional variables becoming useful in conjunction with other tools that deal with Zotero data.
  • edited March 16, 2022
    Is there any possiblity to incoporate color info of the highlighted annotations when exporting them as markdown files? Like supporting to switch on the following label upon note exporting

    <p><font color='{{color}}'>{{highlight}}</font></p>
  • @dstillman , is that possible to wrap tag with bracket like this?
    #[[tag one]] #[[tag two]] #[[tag three]]
  • @alexdai039: You can set the delimiter to anything you want using the join parameter, so, sure — you would set it to ]] #[[ and add the appropriate strings before and after.
  • Hi, I managed to implement with this code for highlight:

    <ul>
    <li>
    <p>{{highlight quotes='true'}} {{citation}}
    {{if tags}} #[[{{tags join=']] #[['}}]] {{endif}}</p>
    {{if comment}}
    <ul>
    <li><blockquote> {{comment}} </blockquote>
    </li>
    </ul>
    {{endif}}
    </li>
    </ul>

    However, when I use quick copy and paste afterwards, the bracket is escaped to \[, like this:

    #\[\[tag one\]\] #\[\[tag two\]\] #\[\[tag three\]\]


    How to change the setting of quick copy, then get the original string like this, I can then paste into external editors, such as Roam?

    #[[tag one]] #[[tag two]] #[[tag three]]
  • The extra escaping is a known issue.
Sign In or Register to comment.