I haven’t used Obsidian-Zotero in a while due to the unresolved bugs, so I am using Zotero Integration for now. But as I recall, some duplication issues were resolved, but the only update method that works for my custom templates is overwriting. In-place updating is still not supported. This is tracked in this open issue: [FR] Implement full support for updating literature notes with grouped annotations in bullet lists · Issue #115 · PKM-er/obsidian-zotero · GitHub
Hey @Feralflora, are you considering switching over to this plugin, now that most issues seem resolved since the recent updates? Any major issues or downsides remaining?
The Zotlit plugin generally works fine for me, but I encountered two issues:
- there is no implementation for related items transferring in Obsidian; I did not find corresponding field in JSON schema.
- the “notes” field is always blank. The array “notes” contains 0 elements in JSON schema regardless of the presence of item notes in Zotero db. Using Zotlit plugin, Zotero db was refreshed without any notes appeared. I left an issue on project page, but there is no feedback yet.
These are the reason not to import my annotations and notes to Obsidian to avoid further rewrite with full-update. Have you faced the same troubles in importing notes via Zotlit plugin?
Update: In the machine with the latest Zotero beta (that of remastered UI) notes are not available in ZotLit template editor (see image) but do persist in the database. In the machine with Zotero 7.0.0-beta.54+6b996d4f9 notes could be successfully imported and rendered via ZotLit.
There is new info on this issue. ZotLit has a bug crushing data retrieval from Zotero while there is coloured highlighted text in item notes. Cleaning text formatting is a workaround enabling Zotero items’ data to be imported via ZotLit. The developer did not response neither in github nor to e-mail so I apologize the ZotLit not to be the thing of the first priority for him. I left some traceback of the error on GitHub. Someone experienced in JS o Typescript might wish to fix this issue in the near future. There are also another three issues opened on the project page those are related to the same bug.
So, to temporally resolve the issue one should clear all coloured highlights in the item note text. There is no cases of another workaroind known.
reviving this to say that I have been using zotero-integration as well for while and did try again with zotlit and it actually quite good… cant really remember what were the bugs that made me stop using it. Perhaps you coudl help me get rid of the == == lines in the annotations and he “/n” at the end of every annotation?
Im using another version of @Feralflora templates.
---
callout: false
---
<% if (it.imgEmbed) { %>
- <%= it.imgEmbed %>\n
<% } %>
<% if (it.comment) { %>
- <% if (it.comment.startsWith('todo ')) { %>[ ] **<%= it.comment.substring(5) %>:**<% } else { %>**<%= it.comment %>:**<% } %>\n
- ==<%= it.text %>== [p. <%= it.pageLabel %>](zotero://open-pdf/library/items/<%= it.parentItem %>?page=<%= it.pageLabel %>&annotation=<%= it.key %>) <% if (it.tags && it.tags.length > 0) { %> <% = it.tags.map(tag => '#' + tag.name).join(", ") %><% } %>\n
<% } else if (it.text) { %>
- ==<%= it.text %>== [p. <%= it.pageLabel %>](zotero://open-pdf/library/items/<%= it.parentItem %>?page=<%= it.pageLabel %>&annotation=<%= it.key %>) <% if (it.tags && it.tags.length > 0) { %> <% = it.tags.map(tag => '#' + tag.name).join(", ") %><% } %>\n
<% } %>
<%
// Initialize colorGroups object to categorize annotations by color
const colorGroups = {};
for (const annotation of it) {
const color = annotation.colorName || 'gray'; // Default color if colorName is undefined
if (!colorGroups[color]) colorGroups[color] = [];
// Remove '==' and any trailing newline from the annotation content
annotation.content = annotation.content ? annotation.content.replace(/^==|==$/g, '').trim() : '';
colorGroups[color].push(annotation);
}
// Define color labels with unique keys based on your updated specifications
const colorLabel = {
'blue': '❓ Problem formulation',
'green': '🎯 Key takeaways',
'yellow': '💬 Evidence and arguments',
'orange': '✅ Actionable takeaways',
'purple': '🧩 Concepts and frameworks',
'magenta': '🗺️ Context and connections',
'red': '🚧 Digging and disclaimers',
'gray': '📌 Statistics and info'
};
// Loop through color groups and output sections
for (const [color, annotations] of Object.entries(colorGroups)) {
%>
### 0.1.1 <%= colorLabel[color] ?? 'Group' %>
<% for (const annotation of annotations) { %>
<%~ include("annotation", annotation) %>
---
<br>
<% } } %>
<% // Additional loop to output all annotations individually with separators %>
<% for (const annotation of it) { %>
<%~ include("annotation", annotation) %>
---
<br>
<% } %>
# 1 [<%= it.title %>](<%= it.backlink %>)
> [!info]+ Links and info
>
>**Publication:** <%= it.publicationTitle %>
>**Pages:** <%= it.pages %>
><% if (it.tags && it.tags.length > 0) { %>**Tags:** <%= it.tags.map(tag => '#' + tag.name).join(", ") %><% } %>
>
> [**Open in Zotero**](<%= it.backlink %>)
> [**DOI**](https://doi.org/<%= it.DOI %>)
> [!abstract]- Abstract
><%= it.abstractNote %>
## 1.1 Notes
<%~ include("annots", it.annotations) %>
Neverming I figure is was not int he zt-annots.eta but in zt-annot.eta to fix that… is working great now.
also did some stuff for the zt-fields.eta
title: "<%= it.title %>"
citekey: "<%= it.citekey %>"
book-title: "<%= it.bookTitle || '' %>"
year: "<%= it.date ? new Date(it.date).getFullYear() : '' %>"
<% if (it.creators && it.creators.length > 0) { %>
aliases:
- "<%= it.creators[0].lastName %><% if (it.creators.length === 2) { %> & <%= it.creators[1].lastName %><% } else if (it.creators.length > 2) { %> et al.<% } %> (<%= it.date ? new Date(it.date).getFullYear() : '' %>) <%= it.shortTitle || it.title %>"
<% } %>
author:
<% it.creators.forEach(creator => { %>
- "<%= creator.lastName || creator.firstName %>"
<% }); %>
item-type: "<%= it.itemType ? it.itemType.replace(/([a-z])([A-Z])/g, '$1 $2').toLowerCase() : '' %>"
publisher: "<%= it.publicationTitle || it.publisher || '' %>"
comments: [<%= (it.comments || []).map(comment => `"${comment.replace(/"/g, "'").replace(/\n/g, ' ')}"`).join(', ') %>]
tags: [<%= it.tags.filter(t => t.type === 0).map(tag => `"${tag.name.replace(/\s+/g, '-')}"`).join(', ') %>]
<% if (it.DOI) { %>
doi: "https://doi.org/<%= it.DOI %>"
<% } %>
<% if (it.itemType === "book" && it.ISBN) { %>
ISBN: "<%= it.ISBN %>"
<% } %>
cssclasses:
- literature-note
- pen-blue
<% if (it.attachments && it.attachments.length > 0) { %>
attachments:
<% it.attachments.forEach(attachment => { %>
- "<%= attachment.path %>"
<% }); %>
<% } %>
How does Zotlit and zotero-integration compare? Anyone care to highlight some pro and cons in each?
Hello @pulha
I used ZotLit and moved again to ZI. ZotLit looked promising but its developer ignores questions and bugs. Sometimes he moves open issues to Discussion board or marks them close without fixing the problem itself, thus making github statistics look nice. ZotLit had some issues with coloured formatting in notes, and some fields like related items were not implemented yet. I hope the project will go forward. It has a great feature - from-zotero selective export. One can export data from entire directory in Zotero database in a single step.
Does anyone have any tips on how I could skip rendering an annotation if it is of a certain type? I don’t want zotlit to import any underline annotations, only highlights and notes. I tried this but it still renders a block-id:
@Feralflora seems like zotlit now supports standalone notes import. Do you happen to know a template that can import all the notes from zotero? I have put up a issue regarding this and some problems but no one responds.
Oh yeah? That’s nice. Unfortunately, I haven’t used Zotlit for a long time, so I don’t have such a template (yet), but it should be relatively simple to implement.
Here’s something I implemented just now, assisted by Zotlit’s template preview and item detail view, available from the annotation sidebar:
From there, you can even right-click the available data and grab a starting template to tweak, like a for-loop over the notes array:
I implemented the note importing as nested callouts, as I have it in my Zotero Integration template.
> [!note]- Zotero notes (<%= it.notes.length %>)
<%_ it.notes.forEach(($it, i) => { %>
>
> > [!example]- Note <%= i+1 %> | <%= $it.title %>
> >
<%= $it.content.split("\n").map(line => "> > " + line).join("\n") _%>
<% }) %>
Yeah, it seems like the block-ids are being added implicitly, in some way that’s separate from the user’s templates. Since I added block-ids manually (a long time ago), I now have them duplicated, because they have since been added implicitly.
The ==
are added in the zt-annot template, you can seem them right there in the first code block you shared, so just remove them from there.
Edit: Nevermind, I can see that you figured it out in another comment.
No, I’m content with Zotero Integration as-is.
Yes, but the image cannot be imported. I see that the image is identified by img alt= “” data-attachment-key= “B2JZ6WE2” width= “1379” height= “582”>, aka the data-attachment-key. Is there a way to load the image into Obsidian as well?
BTW, can zotero-intergration import notes with images? I would be really grateful if you can point out (or give a link) on how to write a template that does this.
I am asking because basically all my notes are stored in the form or better-notes in zotero. Thanks a lot!!
I have a question I hoped to get some help with. I would love to have a template where the following happens:
- I highlight all headings in the PDF with purple, and when I export the highlights to Obsidian with Zotlit I would like it to export these highlights as level 2 headers (## SOME TEXT).
- Underneath these headers, the template should place the other colored highlights in color-categories.
I managed to do something similar with the help of ChatGPT, but it just ended up letting the page-number be the structuring principle instead of the purple headers.
An example of what I would like:
# Annotations
## HEADER TEXT (purple highlight in PDF)
### Highlights (all yellow highlights underneath this purple header)
> [!note] PURPLE HEADER, p. X
>
> ANNOTATION
### Examples (all red highlights underneath this purple header)
> [!example] PURPLE HEADER, p. X
>
> ANNOTATION
And so on, and on for every highlight. Is it possible? Thanks in advance!