Zotero -> Zotero2MD (python library) -> Markdown workflow

This is about Zotero2MD Python library I just released that retrieves all Zotero annotations and notes, and outputs them to markdown files. The workflow I’m suggesting here is as follows:

Zotero → zotero2md Python library → Obsidian

Please NOTE that this is NOT a replacement for the other workflow described in
Obsidian Forum: Zotero → zotfile → mdnotes → obsidian → dataview Workflow.

The main difference here is that the new Zotero (available in Windows, MacOS, and iOS (beta)), you can annotate PDF files without actually saving to PDFs.

The new Zotero PDF Reader and New Note Editor (see Zotero announcement) makes it much simpler to annotate PDF files even on iOS devices (currently in beta).

You can checkout the library README here to install the library and run it.
You can install the library using pip install zotero2md from a shell terminal (refer to README for more instruction).

Features:

  • Convert Zotero tags to Obsidian Internal links ([[ ]]). This is the default behavior.
  • Choose some Zotero tags to avoid being converted into internal links.

For a list of all custom output parameters, you can check the Custom Output Parameters section of the library README.

Minimum Requirements

  • Zotero Key (from here)
  • user ID (from here if it’s personal library. If it’s a group library, please check the instructions in here)

Usage

After installing the library, you can do all the conversion in one of the following two ways:

Approach 1 (Run a python script)

After installing the zotero2md, download the output_to_md.py file from the library GitHub repository, and then just run
python output_to_md.py <zotero_key> <zotero user/group ID>.
You can get more information on how to run the Python script by simply running

python run.py --help

For example, in my case,

Approach 2 (through a Python terminal)

This approach is more flexible as it also allows you to save any failed items.

Example

A sample MD document output is given below:

# Test Document

# Metadata

- **Author:** Essi A
- **Date:** 2021

# Notes

- A test note 2 modified

- abc def dsafsa ![]() a test
  - [[Artificial Intelligence]]

# Highlights

- incididunt (*Page 1*) (Highlighted on 2021-12-31T17:13:48Z)
  - **Comment**: def
  - [[Artificial Intelligence]]
- consectetur (*Page 1*) (Highlighted on 2021-12-31T17:13:30Z)
  - **Comment**: abc dsafasf
  - [[Artificial Intelligence]]
- eiusmod (*Page 1*) (Highlighted on 2021-12-27T01:12:56Z)
  - [[Machine Learning]]
- a test note (Note on *Page 1*) (Highlighted on 2021-12-27T01:12:35Z)
  - [[Artificial Intelligence]] [[Machine Learning]]
- adipiscing commodo (*Page 1*) (Highlighted on 2021-12-22T18:22:37Z)

- labore (*Page 1*) (Highlighted on 2021-12-22T18:22:31Z)

- Lorem ipsum (*Page 1*) (Highlighted on 2021-12-22T18:22:21Z)

Feel free to post any suggestion or bug.

5 Likes

It is a very nice project. In a “very user” perspective the hassle is, moving the md. files from one place to another. Also when I do changes(new annotations) on my zotero file, can it update the notes/highlights? Thank you!

1 Like

This is interesting! What’s the advantage over the Obsidian-Zotero Integration Plug-in?