MDNotes and Zotero 6 Questions

Hi all,

My intention is to use the MDNotes extension to export metadata and annotations to Obsidian using Zotero 6.

Questions / issues:
1.) Formatting the 'MDNotes Default Template' file in Obsidian

Here is the present formatting of my template:

---
alias: {{citekey}}
---

{{title}}
{{author}}

## Zotero links
{{localLibrary}}
{{cloudLibrary}}

## Metadata
- **PDF:** {{pdfAttachments}}
- **ItemType:** {{itemType}}
- **Title:** {{proceedingsTitle}}
- **Author:** {{author}}
- **Date:** {{date}}
- **Date Added:** {{dateAdded}}
- **URL:** {{url}}
- **DOI:** {{DOI}}
- **Citekey:** {{citekey}}
- **Collections:** {{collections}}
- **Related:** {{related}}
- **Tags:** {{tags}}, #Literature


{{abstractNote}}

---

PROBLEM: All of the variables generate a "* (variable name)" prior to listing the variable itself. I would like for the variables just to fill in without the asterisks and variable title, thus allowing ME to add in the titles for each variable's section. It's just cleaner that way. Also, an issue arises with the alias in which the citekey variable doesn't add in just the citekey; again, it adds "* citekey:" before listing the citekey itself. Can the template for each of these variables be changed in some way to address this issue?

2.) {{abstractNote}} variable issues
Question A: When I export annotations from Zotero into Obsidian using MDNotes, it lists in the exported Obsidian file the title "Annotations" twice before listing the annotations. I think that this is because Zotero lists the "Annotations" title in the original annotations file, and then the MDNotes variable template also lists the title. Again, can the MDNotes variable template be tweaked in some way?

Question B: My annotations in Obsidian do not have hyperlinks back to the annotation's exact location in the PDF. Is this a pending feature following the Zotero 6 upgrade? I remember that MDNotes was capable of doing this when I used it a year ago.

---

Thank you to anyone who can assist me with these questions! Take care.
  • edited May 23, 2022
    You might get help on Obsidian forum or Discord (there a whole thread academia there where people share many tips on Zotero use and templates), the creator of the plugin is active and might answer questions there :) (on the Zotero forum as well)

    Under Zotero 6 the active development now is much lighter than before, the other nice plugin for Obsidian is https://github.com/mgmeyers/obsidian-zotero-integration

    Here some interesting workflow https://publish.obsidian.md/history-notes/From+Zotero+Annotations+to+Obsidian+Research+Notes

    There is also a bibnotes formater that might have a better support for notes extracting https://github.com/stefanopagliari/bibnotes
  • edited May 23, 2022
    >PROBLEM: All of the variables generate a "* (variable name)" prior to listing the >variable itself. I would like for the variables just to fill in without the asterisks and >variable title, thus allowing ME to add in the titles for each variable's section. It's >just cleaner that way. Also, an issue arises with the alias in which the citekey >variable doesn't add in just the citekey; again, it adds "* citekey:" before listing the >citekey itself. Can the template for each of these variables be changed in some way >to address this issue?

    If you have problems with the field values it could be edited with the Preferences>advanced > Config editor but it shouldnt be the case, I never experienced this beviour
  • You said you want to use the MDNotes plugin to export metadata and notes to Obsidian, but I would like to suggest using the Obsidian Zotero Intergration aka. Zotero Desktop Connector community plugin

    Here's an Obsidian link: obsidian://show-plugin?id=obsidian-zotero-desktop-connector

    Here's the Github link: https://github.com/mgmeyers/obsidian-zotero-integration

    Using this Obsidian plugin and the template below, you can very easily import metadata and annotations / notes from Zotero into Obsidian, directly within Obsidian. The variable name will not be present after using the template.

    In my template, I have some of the metadata in the YAML frontmatter, and also in a callout below. I use callouts for the metadata and the abstract.

    You have to setup an import format (I called mine "Literature note") in the settings of the Zotero Integration plugin, which will then use the template.

    The plugin has a command called "Data explorer", which will tell you the available variables. Their templating documentation is found here: https://github.com/mgmeyers/obsidian-zotero-integration/blob/main/docs/Templating.md.


    Here's the template, but you could easily adapt your template for Zotero Integration:

    ---
    citekey: {{citekey}}
    alias: [{% if shortTitle %}"{{shortTitle | safe}}"{% else %}"{{title | safe}}"{% endif %}]
    title: "{{title}}"
    authors: {{authors}}
    tags: [{% for t in tags %}{{t.tag}}{% if not loop.last %}, {% endif %}{% endfor %}]
    year: {{date | format("YYYY")}}
    publisher: "{{publicationTitle}}"
    ---

    ## {{title}}
    >[!info]-
    >{% if bibliography %}
    >**Bibliography:** {{bibliography}}
    >{% endif %}
    >{% if hashTags %}
    >**Tags:** {{hashTags}}
    >{% endif %}
    >{%- for attachment in attachments | filterby("path", "endswith", ".pdf") %}
    > **Link:** [{{attachment.title}}](file:///{{attachment.path | replace(" ", "%20")}}){%- endfor -%}
    >
    >[**Open in Zotero**]({{desktopURI}})
    >[**Open DOI**](https://doi.org/{{DOI}})


    ---


    > [!abstract]-
    > {% if abstractNote %}
    >{{abstractNote}}
    >{% endif %}

    ---

    {% if markdownNotes %}
    {{markdownNotes}}{% endif %}
  • @ingmar93, I cannot thank you enough for this recommendation! The Zotero Integration Plugin is a HUGE leap in ease-of-use and functionality (i.e. annotations have a link that opens the exact annotation location within the PDF).

    A few quick questions related to the Zotero Integration Plugin in case you or someone else can address:
    1.) Is it possible for exported annotations to indicate the color of each annotation? The MDNotes export allows for this IF an annotation note is generated within Zotero 6, and if "display colors" are enabled for that specific annotation note.

    2.) In reviewing the readme file for the Zotero Integration Plugin, it seems like the plugin has the capability to extract annotations from a PDF without the need to generate an "annotations" note manually inside of Zotero before exporting the source into Obsidian. However, after experimenting with this plugin, I cannot find a way for it to auto-extract annotations from a PDF, regardless of whether the annotations are created within Adobe Acrobat and saved to the PDF itself, or if the annotations are created inside of Zotero 6's PDF viewer. I must generate an annotation file in Zotero in order for those annotations to carry over into Obsidian. This isn't a big deal; it would just be nice if this plugin eliminated the step of needing to generate an annotations note every time I want my annotations to appear in Obsidian.

    Happy researching!
  • Regarding 1., it is possible to indicate the color, if you change the note template for annotations under in the config editor under advanced settings. See the relevant Zotero documentation in the knowledgebase.

    2. If your problem here relates to the template I shared, then that's because it only imports the markdown notes, or annotations saved in a note using "Add note from annotations", associated with the reference.

    You can also import embedded annotations from PDFs, I have since learnt. In contrast to annotations made within Zoteto, embedded annotationa are saved under the {{annotations}} variable. So you need to add something like this to your template:

    {% for annotation in annotations %}
    {% if annotation.annotatedText %}
    > {{annotation.annotatedText}}
    > {% endif %}
    > {% if annotation.comment %}
    > {{annotation.comment}}
    {% endif %}
    {% endfor %}

    However, these embedded annotations with not come with links to the exact annotation location.

    Alternatively, you can convert embedded annotations into Zotero annotations by using File -> "Import annotations" while in the PDF reader. Then, these can be exported to an annotation note and import that way into Obsidian, along with any native notes and annotations.

    As far as I can tell, it is not yet possible to auto-extract annotations made within the Zotero PDF reader to a note, thus making it importable into Obsidian. You have to manually trigger "Add note from annotations", which makes the workflow a bit less seamless. Such an auto export/extraction feature would be great enhancement.
  • Thank you for explaining all of this! I'll read the documentation from here. It looks like extracting annotations from a Zotero PDF is the best way to go. The ability both to see highlight colors and link back to the location of each annotation is very powerful.
  • @ingmar93, I read through all of the available documentation for Zotero Integration Plugin, but see nothing that references how to indicate annotation color after importing annotations into Obsidian via the 'markdownNotes' variable. I see that this is possible when using the 'annotatedNotes' variable; however, I don't use that variable since I save my annotations using the Zotero PDF reader.

    I posted this question/issue to the GitHub for the plugin. Still, I'm mentioning it here in case you're aware of an easy way to fix this. If not, no worries. Thanks again for your (and others!) help.
  • That's because it's in the Zotero documentation, but appears to be quite buried, as it is not linked on the documentation page: https://www.zotero.org/support/note_templates

    You need to change the note template in Zotero using the config editor under advanced settings.
  • OK, we're on the same page now. I never knew about accessing the config editor inside of Zotero's advanced options. There's lots here to tweak; very cool!

    I played around with the variable 'annotations.noteTemplates'; however, still no joy in color highlights carrying over into Obsidian using the Zotero Integration Plugin. This isn't a big deal as I'm coming to realize that I could using things like blockquotes, emboldening, and italics to delineate between the varying highlight colors. Still, it would be nice if colors could be shown, like the MDNotes plugin makes possible.

    Also, I found out that I can edit all of the formatting for the MDNotes variables within the Zotero config editor that was a stated issue in the first post of this thread. I'm debating whether to do that and then go back to MDNotes, or stick with Zotero Integration Plugin. I lean toward the latter since it allows for direct hyperlinking to quoted text whereas MDNotes does not.
Sign In or Register to comment.