Zotero Sync
approvedby Frithjof Gressmann
Zotero API client to sync your Zotero library into your vault.
Obsidian Zotero Sync Client
This plugin leverages the Zotero Sync API to mirror your Zotero library as markdown files within Obsidian.
Zotero does not have to be installed since the data is directly obtained from Zotero's web API - all you need is an Zotero API key and internet connection when syncing. Alternatively, you can enable synchronization with your locally installed Zotero App.
Note that, by design, the synchronization is read-only and does not modify your Zotero library. Any changes to the markdown files will be lost and not synced back into Zotero. The rationale is to enable seamless Zotero integration via note linking and search while keeping all literature data within Zotero.
Alternatives
This plugin is for you if you are interested in linking to and searching through a read-only version of your Zotero library within Obsidian. Check out the following alternatives if you are interested in:
- Taking notes directly within Zotero (with two-way sync to Obsidian): Zotero Better Notes
- Importing citations on-demand into Obsidian: Obsidian Zotero Integration or Obsidian Citation Plugin
- Integrating with Zotero via the ZotServer API: Zotero Bridge
- Suggest other alternatives ...
Usage
Install the plugin and enable it in the settings. Generate a Zotero API key and fill it in the plugin settings. Alternatively, you can enable the local API in your Zotero App and enable local sync (Zotero > Settings > Advanced > Allow other applications on this computer to communicate with Zotero).
The plugin will sync and cache all Zotero data incremently to minimize API usage.
After initial synchronization (which may take a while), all Zotero notes should appear in the configured vault folder.
Mobile devices
While this plugin is only available on desktop, any generated Zotero markdown files will be synced to connected mobile clients just like any other file.
Custom templates
By default, the markdown files are generated using a standard template which can be previewed and modified in the settings, giving you full control over the file generation.
During template generation, you can access the item data as well as the global $collections and $items mapping which contains all collections and items. Furthermore, the library information is available in the $library variable.
Example template
let n = '';
// generate properties
n += '---\n';
n += 'Tags:\n';
n += data.tags.map(t => {
// remove spaces around hyphens and replace other spaces with underscores
let formattedTag = t.tag.replace(/\s*-\s*/g, '-').replace(/\s+/g, '_');
return '- "' + formattedTag + '"';
}).join('\n');
n += '\n';
n += 'Collections:\n'
if (data.super_collections) {
console.log(data.super_collections)
n += data.super_collections.map(k => '- ' + $collections.get(k).name).join('\n');
}
n += '\n';
n += 'Library: ' + $library.name;
n += '\n';
n += 'Authors: \n';
if (data.creators) {
data.creators.forEach(author => {
n += '- "[[People/' + author.firstName + ' ' + author.lastName + ']]"\n';
});
}
"\"\n";
n += '---\n';
// generate content
n += data.marker;
n += '\n\n';
n += '## Abstract ' + '\n' + data.abstractNote + '\n\n';
n += '\n\n';
if (data.children) {
const notes = data.children.filter(
c => c.itemType.toLowerCase() == 'note'
)
notes.forEach(c => {
n += c.note_markdown + '\n\n';
});
}
return n;
Acknowledgements
This plugin uses the excellent retorquere/zotero-sync package for the Zotero API integration.
For plugin developers
Search results and similarity scores are powered by semantic analysis of your plugin's README. If your plugin isn't appearing for searches you'd expect, try updating your README to clearly describe your plugin's purpose, features, and use cases.