Formatting of exported annotations/ highlights (and other questions)

edited November 6, 2022
I really, really like the drag and drop export of annotations from zotero into a text editor (Obsidian, in my case), but I still don't fully understand it yet (and based on what I read from other users, I'm not alone), so I'd like to point out some areas of confusion and ask for clarification:

1. There are various ways of getting annotations into a text editor and I'm not sure how they relate to each other (and which of them are provided by Zotero itself and which rely on add-ons. For example:

- dragging and dropping an annotation/highlight from the annotation pane seems to yield the same results as dragging the corresponding annotation from the pdf in Zotero reader. But I'm not sure whether this is coincidental or by design (some users seem to get different results).

- is the drag and drop operation synonymous with Quick Copy of Notes (as in Preferences -> Export)?

2. Annotations/highlights are obviously new terms in Zotero 6 while "Notes" have existed in Zotero forever. But it seems that _some_ settings that apply to Notes also apply to annotations (see Quick Copy of notes above or the advanced settings extensions.zotero.annotations.noteTemplates.... The latter admittedly also have "annotations" in their name, but when they refer to *note*Templates, this seems to be notes in a broader sense.)

3. I'm really glad I found this explanation of how to customize the formatting of exported annotations: but it doesn't explain where the variables like {{citation}} or {{highlight}} are defined (or how to change their internal formatting). The {{highlight}} variable seems to include not just the highlighted text but also a link to the deep-link to the annotation in zotero reader.

- It's great that this link is available, but it is somewhat counterintuitive that it "hidden" inside the {{highlight}} variable. It also seems to behave somewhat strangely as it seems to render differently depending on its proximity to the {{citation}}: if the template is <p>{{highlight}} {{citation}} {{comment}}&lt;/p>, the pdf-link is inserted between the citation and the comment but in <blockquote>{{highlight}}</blockquote><p>{{citation}} {{comment}}</p> it is part of the blockquote, i.e. inserted between highlight and citation. Is there any way of getting into the {{highlight}} variable somewhere, i.e. to change its composition?

- I would also like to customize the {{citation}} variable but none of the citation-style settings seems to affect it. Or did I miss one? Also this variable I would like to get into and tweak it. My idea is to put the link to the zotero item (which is currently under the entire citation) just under the Author Year part and then use the deep link (which currently is locked inside the {{highlight}}) as a link under the page number of the citation. But as far as I can see, this is nothing the user can modify, right?

4. I have tried to customize the template at extensions.zotero.annotations.noteTemplates.highlight so that the citation is justified right instead of left like this: <blockquote>{{highlight}}{{if tags}} #{{tags join=' #'}}{{endif}}&lt;/blockquote><div style="text-align: right">{{citation}}</div>{{comment}}

but it doesn't work. If I paste <div style="text-align: right">{{citation}}</div>, however, it renders correctly in obsidian. So I suspect that the html code is removed before pasting? Is there any way of knowing which HTML-tags are removed and which aren't?

5. To what extent does the receiving editor matter? By that I mean: whether it is a plain text editor, rich text editor or, as in the case of obsidian, also accepts HTML. I am also asking because I noticed that dragging-and-dropping of annotations only works if the editor window was the last window in focus before losing it to Zotero. If I come from another app and try to drag an annotation into obsidian, it just bounces back into Zotero.

P.S. This post was a pain to get to render properly because the forum editor apparently doesn't understand markdown and misinterprets all < as HTML code so that I had to replace all of them with, well, I can't get this to render either, because it will simply render as "<" - I couldn't find any instructions on how to paste code in a forum post. (Fixed the post with <code> and </code>, thanks @adamsmith!)
  • edited November 6, 2022
    (The forum renders (filtered) html, so put HTML code in <code></code> brackets, use <em></em> for italics, <blockquote> for quoting etc.)
  • edited November 20, 2022
    @haug : Great questions ! I'm particularly interested to know if someone has answer for questions 3 and 4.

    I'm using the following highlight template (as explained :

    {{citation}} {{comment}}

    But when I drag and drop a note into Obsidian, I get the following :

    > highlight


    However :

    1. How to change citation format ? I don't want "PDF_NAME" but say "citeKey" ?
    2. How to get a link with PAGE_NUMBER ? Currently, there is no link that redirects to Zotero.

    Thanks !
  • I face the same problems. @haug
  • I have the same question. I would like to modify the style of {{citation}}.
    Look forward to this function can be added in the following update. Thank you!
  • Same problem here, I would also appreciate this function of added in the following update.
  • Same questions here! It seems that the deep link (e.g. "[Go to annotation](zotero filepath)") is bundled into the item notes template in a way I can't understand how to modify in the Config Editor templates...
  • Have you ever tried to import your highlights and notes from obsidian plugins instead of doing drag and drop?
  • Same questions here!
    I have the same question.
    Same problem here
    Folks, this isn't getting us anywhere. I know I made the mistake of combining five issues into one post, but answering "me too" doesn't exactly make things better. Which of the five issues in the OP are you referring to?
    It seems that the deep link (e.g. "[Go to annotation](zotero filepath)") is bundled into the item notes template in a way I can't understand how to modify in the Config Editor templates...
    Yes, I think a lot is baked into the {{citation}} and it doesn't look like the developers want to open up that variable. I read a post saying something like that the other day, but I can't find it now.

    Regardless of what will or will not be implemented, I think it would be great to get some clarity about how the {{citation}} variable is rendered.
  • Have you ever tried to import your highlights and notes from Obsidian plugins instead of doing drag and drop?
    Yes, I use the Obsdian Zotero Integration plugin ( most of the time. It gives us access to all fields in the Zotero database. In other words, it circumvents the variables mentioned in the OP. That is useful for exporting literature notes (i.e. notes containing all annotations for an item in Zotero), but in some situations, like when I'm writing a not on a specific concept, it is much more useful to drag and drop annotations directly from the Zotero reader into Obsidian, and that is where the questions raised in the OP are still relevant.
  • edited May 6, 2023
    Mmm I just had a quick look but as for the copy paste to obsidian, I got the citation properly displayed rather than the "PDF_NAME" i.e. (Smith, 2000). Also, I had citations in obsidian from last year that includes the link to the citation (I click and got transported to the in-text location). I couldn't' explain this at the moment, maybe some updates from obsidian side but that would be unexpected and probably already spotted by the community. Did your check the item metadatas and also that the pdf has a parent item? Also check the edit->preferences -> export-> and tick the menu "include Zotero links".

    As for variable editing, I don't think that is possible at this moment.
  • @alflamingo I take it that you are responding to @JorgePLK's earlier post above, but I looked into this anyway as part of my effort to wrap my head around how annotation export works.

    I am also unable to reproduce the output of “PDF_NAME”. {{citation}} produces a an "author-year, page"-type citation (which is correctly linked to the zotero item if "include Zotero Links" is checked under edit->preferences -> export.

    Could it be that the results @JorgePLK saw earlier are due to there not being any author names in the item concerned? (I suppose that's what you meant by "check the item metadata").

    In any case, what remains unclear to me is where the formatting of the author-year reference comes from. I have tried both changing the Quick copy Item Format (in settings -> export) and the citation style selected in settings -> Cite but neither of these settings seems to affect how {{citation}} is rendered.

    I think part of the confusion is due to Zotero's explanations in the "Export"-tab are incomplete. It states:
    Quick Copy allows you to quickly export items in a given format. You can copy selected items to the clipboard by pressing Cmd+Shift+C or drag items directly into a text box in another program.

    For citation styles, you can copy citations or footnotes by pressing Cmd+Shift+A or holding down Shift before dragging items.
    So it talks about items and citations but not about annotations.

    I also find the terminology confusing. The way those two paragraphs are written suggests that they are talking about exporting two different kinds of things, "items" and "citations", but they are not. They are both about exporting items. The difference is in how these items are rendered once they are exported. In the first paragraph
    the exported item will be rendered as a full reference (i.e. an item in a bibliography) and the second paragraph will render the item as an in-text citation (e.g. author-year).

    It says nothing about exporting annotations, yet, the "note format" settings apply to annotation export. So, the Quick Copy settings are not just about exporting (Zotero-)items, but also about exporting annotations...

    So, my suggestion would be to change the explanation text to something like this:
    Quick Copy allows you to quickly export items and annotations.

    To export items as a bibliography, you can copy selected items to the clipboard by pressing Cmd+Shift+C or dragging items directly into a text box in another program.

    To export selected items as in-text citations or footnotes, you can copy them by pressing Cmd+Shift+A or holding down Shift before dragging items.

    To export selected annotations (from Zotero Reader), you can copy them by pressing Cmd + C or dragging them directly into a text box in another program. When exporting annotations, the Note Format settings are applied.
  • @haug I'm afraid I cannot provide a more detailed answer, but that's a valuable feedback for sure and I'm quite confident that the Zotero team will read this carefully. Now as it seems that the 7.0 version is coming soon, and that will be a significant change, I guess we'll have to wait a little and see how the export and metadatas are newly managed (if this is even planned to be changed, as I don't have info on this matter).

    About the “PDF_NAME” ouput, my guess was indeed that the author field was empty.

    Also, to clarify any doubt, at this moment I'm just a Zotero user without other kind of affiliation to this organisation.

    Good luck!
  • You could also try to give a shot on the dev google group or take a look at the code on github.
  • Hi, is there any news on the option to change the {{citation}} variable when copying an annotation? Not having the citekey automatically inserted with my annotation really disrupts my workflow... I would be so glad to know if there is a way to do that by now! Thanks a lot in advance!
Sign In or Register to comment.