Zotero best practices

My friend helped me to write a small Python parser of my bibliography in BetterBibtex bib file and save every reference as md file in Obsidian vault.
How to use it:
1: install BetterBibtex as described in Zettlr docs. Citation key later will serve as a filename so use appropriate keys, i.e. no semicolons or other special symbols are allowed.
2. Copy the script (below) and bib file into references folder inside your vault.
3. Run the script:

import json
import collections

def flatten(d, parent_key='', sep='_'):
    items = []
    for k, v in d.items():
        new_key = parent_key + sep + k if parent_key else k
        if isinstance(v, collections.MutableMapping):
            items.extend(flatten(v, new_key, sep=sep).items())
            items.append((new_key, v))
    return dict(items)

def flatten_publication_info(publication_info):
    if publication_info.get('author', False):
        publication_info['authors'] = [author['family']+' '+author['given'] for author in publication_info['author']]
        publication_info = flatten(publication_info)
        return publication_info
    elif publication_info.get('authors', False):
        publication_info['authors'] = [author['family']+' '+author['given'] for author in publication_info['authors']]
        publication_info = flatten(publication_info)
        return publication_info
    return None

f = open('My Library.json','r', encoding='utf8')
data = json.load(f)
for elem in data:
        flat_publication = flatten_publication_info(elem)
        if flat_publication:
            filename = 'ZOT' + elem['id'] + '.md'
            writer = open(filename,'w+', encoding='utf8')
            title = flat_publication['title']
            abstract = flat_publication.get('abstract','Empty')
            authors = ';'.join(flat_publication['authors'])
            writer.write('tags: #zotero #reference\nlinks: [[Zotero library]] [[Readings MOC]]\n') #header
            writer.write('### %s\n ###### Authors\n%s\n ###### Abstract\n%s' % (title,authors,abstract))
    except Exception as e:
        print('Problems with %s' % (elem['id']))

It will produce a lot of md files that you could reference from Obsidian. It will look like this:


That‘s cool, doing everything in Obsidian.

1 Like

I’ve posted the plugin I wrote before in Zotero integrations - #30 by argentum (updated workflow here), but I thought I’d add here a few things that could help make the most of Zotero (and also of the mdnotes plugin itself). My workflow

How to

Extract annotations and highlights

Zotfile will extract annotations from your PDF and store them as notes in Zotero. The notes include links to the specific page in the PDF where the highlight was made:


You can configure how to format these HTML notes with Zotfile’s hidden preferences, check the .pdfExtraction settings here

Keep in mind that if you annotate your PDFs, Zotfile is also able to extract “pop-up notes”, but not inline notes. These highlights:

End up in this note:

Splitting annotations and Highlights into different notes

There are a few settings worth looking into, depending on your workflow:

  • By default, the extensions.zotfile.pdfExtraction.colorNotes setting is turned off, which means all the highlights and annotations will be extracted to a single note.
    • You can change the format of the title with extensions.zotfile.pdfExtraction.formatNoteTitle

    • Setting extensions.zotfile.pdfExtraction.colorAnnotations to true, will add the color as a background in the annotations, and you can use %(color_category) to add labels in extensions.zotfile.pdfExtraction.formatAnnotationHighlight according to the colors in extensions.zotfile.pdfExtraction.colorCategories

  • Splitting notes by color can be turned on by setting extensions.zotfile.pdfExtraction.colorNotes to true
    • You can customize the title of the note in extensions.zotfile.pdfExtraction.formatNoteTitleColor

Export notes to markdown

Now that you have notes attached to your Zotero reference, you can export the reference’s metadata and your highlights and annotations to a markdown file.
The menus in Zotero are unfortunately not context-aware, so to know what to select for each menu follow the cheatsheet at the top of the README of mdnotes. The plugin helps with the following:

  • Exporting metadata of a reference
  • Exporting Zotero notes (e.g. those extracted by Zotfile or literature notes written by you)
    • The export format for markdown is a little hardcoded (right now), but you can experiment with changing Zotfile’s notes formats and include markdown or wikilinks in your annotations:

    • If you want to structure your notes, you can use underline (instead of highlight) to create H4 headings. A PDF like this:
    • After being exported, results in a markdown note like this:
  • Creating a file for your notes. Since this file contains your notes, this is the only file that won’t be overwritten during batch export. If you want to replace it, you can choose the Create Notes file menu.

The plugin also can add these files you created as links to Zotero so you can double click them and edit them.

The default settings export all the information of the references in multiple files. If that doesn’t work for you, there some settings to play around with, depending on what you want:

  • If you don’t want to “pollute” your graph, you can choose to export everything in a single file.
  • If you don’t want to include highlights and annotations in your export (e.g. as literature notes), you can either disable them in the settings so they’re not included in the export. If you export everything in a single file, you can have the metadata in the same file.
  • Instead of using batch export on every item, selectively choose what you send to your vault by using the individual menus.

Get links to a Zotero item or PDF

You can use Zutilo to get a link to the Zotero item or a PDF. You want to enable Copy select item links in Zutilo’s settings so that it shows up in the context menu or as a shortcut. That will give you a link with Zotero’s URL e.g. zotero://select/library/items/FE7B33LA which you can format in markdown.

Update: @silent developed a Zotero translator to easily copy markdown-formatted zotero links here.

Naming conventions

Using Zotfile and Betterbibtex, it’s possible to establish certain rules about how your files are named. I covered this in a reply further down:

Web clipping

In order to successfully use Zotero to save articles, it should have a “translator” that can correctly get the data for the citation out of it. You can find a list of existing translators here



That’s cool - thanks for that detailed overview!

I have been working with zotfile for quite a while now and more recently with mdnotes - but I just realised that so far I obviously only have discovered a small part of zotfile’s power! I wasn’t aware of zotfile’s hidden preferences that allow you to even better organise your notes - thanks for calling my attention to this! :slight_smile:

1 Like

Sorry that I just created another post to introduce related methods, now I introduce it again here.

In Obsidian 0.8.15, you can use URL scheme to jump to specific note.

So I share a geek way to achieve something interesting with you.

First of all, I am using pdf X-change editor plus, Zotero, Quicker(a software like autohotkey but has a GUI)

Jump from Obsidian to pdf

  1. Select what you want to save in Obsidian.
  2. Copy it and use pdf X-change editor plus to get the file path of what you are reading, capture its zotero’s library parameters(like G78UAI9B) by using autohotkey or any software you want.
  3. Get the page number of the text you selected.
  4. Then insert the library parameters & page number into the link(like: zotero://open-pdf/library/items/G78UAI9B?page=9).
  5. You can make similar text like follow.
  6. Paste it in you obsidian note. Ctrl+E, You could jump from your note to pdf now.

Jump from pdf to Obsidian

  1. Get the URL link of your note.
  2. Add a web link to the text you selected in your pdf.
  3. Paste the URL link of your note in it. Click it, you could jump from pdf to your note now.

PS: If anyone find a better way to do these, please share it with me. Thanks.
PPS: The official website of Quicker software I use is https://getquicker.net, and its free version does not require login, so you can try to use it.
The script I use is:

  1. pdf to OB
  2. OB to pdf

Sorry that I didn’t add a English translation to their introduction.

A geek gif as follow:

link: Combine Zotero with Obsidian (Jump from pdf to Obsdian’s note)


Thank you for this amazing guide. When extracting annotations from zotfile, is it possible to replace or delete the old one extracted annotation note?


If you mean the yellow Zotero notes, I don’t think it is possible. Zotfile creates new notes every time you extract new annotations, if you want to get rid of them I think deleting them manually is the only way. I think there may be use cases where people annotate/highlight the PDFs for different purposes and/or at different times, and might want to keep the old notes too.


Has anyone created at alternative copy (i.e. Quick Copy alt 1) that is specific to Markdown? Ideally I’d have it copy the [Title](zotero link) rather than just the simple Zotero link. I’ve been trying to figure out how to do this, but any pretty lost…

1 Like

There you go! copy-link-to-selected-item

1 Like

How are you guys avoiding special character in titles names in Zotero? I have set zotfile to replace special characters, but it seem to only do it for the filenames and not the actual title within Zotero.

@argentum Can you help me understand the role of this line of code in the zotfile .travis.yml file? I’m extra cautious about software installs, even when they’re open source.

- curl -F "file=@zotfile-build-$TRAVIS_BUILD_NUMBER.xpi" https://api.anonfile.com/upload

I only became aware of “curl” this week, and I think the idea is to use it to download/build packages. I’ve been using homebrew, and read a bit about macports, then saw a bit about curl. But what’s up with the anonfile “upload” bit? If I use zotfile, what am I uploading, if anything?

Hey @s0ph0s, let me start with the disclaimer that I’m not the Zotfile developer, so all the explanation below is just based on my experience as a dev. I also want to say that there is no reason to be worried about that line, since Travis can’t run in your computer.

Travis is a continuous integration service, that is, something you use to test and build your code, and, in Zotfile’s case, “deploy” your code. You can see how Travis executes the commands listed in that yaml file over here. They seem to be using it to upload the xpi file to the link in that line, most likely to be able to send it to people if they need to test a fix.

I don’t use Zotero, but just a plain .bib file for my references. Since Zotero users might export their data with Better Bibtex to a .bib file, too, this might be interesting to some of you (works on macOS and probably on Linux, requires certain familiarity with terminal applications):

1 Like

Thank you, so this works for me now.

This part is less clear for me. I realized my pdf is now moved to ~/Zotero/storage/MCDERLHB where MCDERLHB is some kind of random name after I did a Add attachment > Add stored copy of file.


I think I want to have the pdf stored inside my obsidian vault. Do you recommend any other parts of the zotero stored inside the obsidian vault as well?

This part is less clear for me. I realized my pdf is now moved to ~/Zotero/storage/MCDERLHB where MCDERLHB is some kind of random name after I did a Add attachment > Add stored copy of file.

To use Zotfile to rename and move your files, you need to use “Manage attachments > Rename attachements”, then the file will be moved to the catalogue you chosen in the Zotfile settings (check Tools)

You shouldn’t manipulate the folder where Zotero store their database.

If you want link to pdf stored in Obsidian vault you simple attach link to that file to Zotero database.

1 Like

Is there any way to get Mdnotes on windows?

@Kayamon Zotero runs on Windows too, you only need to install the plugin to Zotero as described here:

To install a plugin in Zotero, download its .xpi file to your computer. Then, in Zotero, click “Tools → Add-Ons”, then drag the .xpi for the plugin onto the Add-Ons window that opens

You can grab the latest version here.

1 Like

Hey Guys,

I have created a simple Zotero translator that creates a markdown link to your Zotero Item when quick copying (drag and dropping) the item into obsidian.


How to Install

  1. Download Markdown.Item.URI.js from Github
  2. Place file inside the “translators” directory in your Zotero data folder
  3. Restart Zotero
  4. In the Zotero Preferences go to the “Export” and set the Default Output Format to “Markdown Item URI” (this will be towards the bottom of the list)

You can now take advantage of Zotero’s quick copy functionality and drag&drop links from the item in your client right into Obsidian.


Thanks for that!! It is really helpful