Available for beta testing: Markdown export of notes

In the latest Zotero beta, we've added support for Markdown export of Zotero notes, without the use of any third-party plugins. Paired with the new PDF reader and note editor, this provides a way to annotate PDFs, add those annotations to Zotero notes, and then export those notes to a Markdown-based tool, with optional zotero://select and zotero://open-pdf links back to Zotero items and individual annotations.

You can now configure a Note Format for Quick Copy separately from an Item Format in the Export pane of the preferences. If only notes are selected in the items list when pressing the Quick Copy shortcut or using drag-and-drop, the selected note format will be used. You can also use "Export Item…" on notes, which will show the export dialog with only note-compatible options.

We've replaced the previous (vaguely Markdown-ish) plain-text format when dragging Zotero notes to a plain-text text area with proper Markdown, and this can now be triggered via the Quick Copy keyboard shortcut as well. As before, both plain text and rich text are put on the clipboard, and the format used will depend on the target application. (In some cases, you may need to paste without style to force a Markdown editor that tries to accept rich text to use the Markdown instead.) If you want raw HTML markup, there's an "HTML" option, which copies HTML markup as plain text, similar to the "Copy as HTML" option for the bibliographic formats.

We'll be adding more customizability to this in future versions, so let us know what sorts of options you'd like to see.

(If you're using Word, LibreOffice, or Google Docs, you can use the Add Note button available in the beta to insert notes with annotations into your document with active Zotero citations and then generate a bibliography from those citations.)

Known issues:

- The zotero://open-pdf links should include annotation parameters to re-select the original annotation, but those are currently missing when using some of the available methods to add annotations to notes, and only a page number is included. If you drag annotations directly from the PDF reader to a note, the annotation key will be included. We'll fix this for all methods in an upcoming version.
- It's not currently possible to copy a note to Markdown while viewing a note in the PDF reader, but we'll make that possible in an upcoming version. For now you have to go back to the library view.
- When using "Export Item…", you can choose whether to include zotero:// URLs in the Markdown export. It's not currently possible to configure this when using Quick Copy.
- Embedded images, including image annotations, aren't currently included in note export. There's not a great way to do this without embedding huge data: URIs, and we haven't yet evaluated how different Markdown editors would handle this. Another option might be to serve images via a local webserver, but I don't know if Markdown editors support live rendering of images or whether that would actually be something many people would want.
  • Great stuff on the markdown export feature.
    Just want to cast my vote here that an option to export image as data URI would be great. That would make for completely portable and versatile MD note file.

    In my note editor (Obsidian), it is trivial to add a CSS snippet to automatically hide or replace the huge URI component when cursor is not on that URI line.
  • Some nice features would be to include the metadata of the parent item, a link to the 'related' notes or documents, and the tags of the note.
    This would allow to link the exported notes to other exported notes or parent items.
    I imagine that proposing a filename based on the name of the note would probably be needed to make it possible to link to related notes.
  • @dstillman Is there any chance you might eventually add the option to just select-all the annotations and drag-and-drop them in Markdown directly from the PDF reader to a target application? It would be great to bypass the extra steps of moving annotations to notes and switching to list view.
  • edited December 28, 2021
    Greatly appreciate all the new markdown export options, the separation of note format and item format in Quick Copy, and particularly the inclusion of links back to individual annotations. Zotero offering markdown notes, markdown export options and every item or note being linkable via Hook to my digital non-Zotero world is great. Looking forward to the copy-a-note-to-Markdown while viewing a pdf annotation.
  • There are two features that may be welcome:
    1、allow to customize the MD template for the Note export, just like [mdnote]
    2、allow to customize the format of the highlight & annotation in Note, just like [zotfile]
  • Exporting images actually be something many people would want. Hoping coming soon. Thanks a lot
  • Great stuff! It might be useful to include the KaTeX extension, so that math equations are rendered in the note editor.
  • edited January 3, 2022
    Really a welcome feature. Since, I personally needed a tool to retrieve not only the notes, but also all annotations (form the new PDF reader), I developed a Python library (Zotero2MD) that does that. It basically retrieves all annotations and notes and output them to markdown files.

    Check it out here:

    All annotation and notes that belong to a Zotero item will be outputted to a single markdown file.

    Since I'm using **Obsidian** as my main note editor, the Zotero2MD Python library allows you to convert Zotero tags into internal links ([[zotero_tag1]]). It's also possible that you specify which Zotero tags to convert to internal links ([[zotero_tag1]]) and which to keep as tags (with #zotero_tag2).

    Check out all available output configurations here: https://github.com/e-alizadeh/Zotero2md#custom-output-parameters

    Feel free to request a feature and/or report a bug: https://github.com/e-alizadeh/Zotero2MD/issues

    --> Please note that this only works for annotations on the Zotero's new PDF reader and note editor as they are saved in Zotero databases (see https://www.zotero.org/support/pdf_reader_preview).

    NOTE: If the features I'm covering in the Python library become available in the Zotero app, I will no longer support the Python library!
  • Another feature that would be welcome: ability to export just one annotation, either into a Zotero note, or directly into another app. Right now, whenever I reread the text and highlight a new section (I tend to do that often, but everyone does it once in a while), I have to re-export ALL annotations into a note, then export the note, then look for the new annotation and extract it. Simplifying this process would help a lot.
  • edited January 8, 2022
    @erazlogo: You know you can add annotations individually to notes? You definitely don't need to add all annotations in the PDF to a note.


    But yes, we'll think about enabling Quick Copy drag-and-drop of individual annotations to other programs.
  • No I didn't realize that, thanks! That helps a lot while I wait for the individual drag and drop feature.
  • It seems not work on iOS yet?
  • edited January 8, 2022
    Yes, this is about the desktop app.
  • I just want to say I've tried this feature for the first time today with Ulysses and it's fantastic. I love having the link to the PDF page right there! The Word 'Add note' feature is really a gamechanger too - I'm blown away by all the fantastic improvements being made.
  • edited January 17, 2022
    Really useful features. Thank you! I thought I might mention that after I create a markdown note, I often want to be able to quickly jump to that note from the Zotero item, and see which items I have already made notes for.

    I wasn't sure if this was in the dev pipeline, so I recently released an add-on that lets you open exported markdown notes from the contextual menu of Zotero items, and adds a colored tag to items so that you can see which items are associated with markdown notes at a glance. https://github.com/daeh/zotero-obsidian-citations

    I'd be interested to hear if/how it works with people's workflows, since markdown exports are becoming a standard feature of Zotero. (Right now ZoteroObsidianCitations is built with the ObsidianMD editor in mind, but it can be easily adapted to work with other markdown storage strategies.)

    Thanks for all these great updates!
  • Is there any documentation or a step-by-step guide that explains how to use this new beta feature for exporting annotations (highlights + notes)?

    As someone not familiar with computer programming, I am having a hard time trying to follow this discussion on what needs to be done to set up to have it all working. Basically, I am wanting to get highlights and associated notes and (independent) notes out of Zotero in Markdown so I can use them in other writing tools as Obsidian. Any guidance that you could provide would be most welcome.

    With the addition of this export feature, Zotero has become unparalleled as a tool for academic research. If only I knew how to set it all up. :)
  • Darren, the good news is no programming is required! I expect since the feature is so new it hasn't been documented yet, and I've used it with Ulysses and Craft rather than Obsidian so the process may be a bit different for Obsidian, but this is the workflow:

    1. In the Zotero library pane, select the note or notes you want to export.
    2. Right-click and choose 'Export Notes ...'. By default, this will include keeping live links to Zotero.
    3. This will open your file dialog so you can save the files as markdown files wherever you choose.

    As I understand it (although I don't use Obsidian myself, so could be wrong about this!), Obsidian essentially reads from a set of Markdown files on your hard drive, so you should just be able to save the Markdown file wherever the Obsidian files are and retrieve it as you would normally. In Craft and Ulysses, you just have to follow the instructions for importing Markdown files.
  • edited January 17, 2022
    @daeh Thank you for your plugin! It is something i was looking for. It seems to work when there is one note in Obsidian from one Zotero item, right? I am looking to use your option 3 (regex) but with many notes--I have several notes for every source. Is that possible?
  • @joycekwc, I followed your instructions and exported the note I selected. Thanks for your guidance. :)

    How did you get the live links added? All that was exported was the text of the note, no live links to Zotero. Also, does this feature work only for notes? Is it able to also work for highlights and the notes that are added to the highlight?

    Maybe I should post in a new thread with a title like "How to use markdown export of notes & highlights in beta test version". I do not want to have this thread filled with questions such as mine.
  • hi @erazlogo - the current version expects that there to be only one MD note associated with a zotero item (following the conventions of the https://github.com/hans/obsidian-citation-plugin workflow), but I could definitely consider adding support for other workflows. Feel free to open an issue in the git and describe your use case.
  • Could this feature potentially be used for natural language processing tasks? A key requirement I think would be a feature allowing export and import of annotations with the precise pdf location of the annotation rather than just a page number. I'm wondering if Zotero might be able to gain some functionalities of these two open source applications for named entity recognition annotations on pdfs:

  • I want to contribute my thanks for the markdown support in the editor.

    My only feature suggestions would be to allow toggling between markdown and rich text (rendered markdown) in the editor--this is typical of many markdown editors--and also allow totally disabling the ordinary rich text editor functionality in the preferences. I like to work 100% in markdown and always find rich text editors cranky. Being able to toggle back and forth between markdown and rendered views would be great.
  • Brilliant features!

    I am wondering if it is possible to directly get the annotation key without exporting the note.
    Personally, I will take notes directly on Markdown-based editors (e.g., obsidian, typora), since my notes usually contain a lot of formulas.
    This feature will be essential for those who take notes directly on markdown editors.

  • edited January 21, 2022
    I am wondering if it is possible to directly get the annotation key without exporting the note.
    @liamma: Do you mean to get an zotero://open-pdf link to the annotation? If so, that would just be implemented by what @erazlogo suggests above — being able to copy an annotation directly as Markdown, with an optional link back to the annotation.
  • edited January 19, 2022
    @erazlogo - the v0.0.12 release supports the `reveal in file system` function for zotero items associated with multiple markdown files. Let me know how it works for you. https://github.com/daeh/zotero-obsidian-citations
  • Thanks so much for implementing this, exporting the whole note is already super useful!

    May I suggest the following additional features?
    1. As already suggested above, it would be great to export selected annotations, to support a workflow where Zotero is used to read, highlight and comment and an external notetaking software is used to later write a summary note.
    2. For image highlights, include a markdown link to the image file so that the image can be displayed by software such as Obsidian, plus a Zotero link to take the user to the original source.
  • @daeh thanks! i've been reluctant to try since i have to run through my entire database of ~45000 references. Did you test your plugin on large databases? If so, I will try!
  • edited January 20, 2022
    @erazlogo my local library is an order of magnitude smaller than that so I'd be keen to get feedback on how it handles larger databases. Most of the operations are pretty light weight, so I'm cautiously optimistic that it would work for large databases, but please do report back if you try it. FYI the plugin doesn't need to run continuously, it just runs the sync operation once at startup, and when it's manually invoked, so it doesn't add much overhead to most interactions with your library (e.g. it doesn't scan your whole library when you add or modify items).
  • @dstillman , yeah, it will work as well. I'm so looking forward to this feature.
  • Amazing!

    But note title is "exported element" afterward, would be a feature suggest to also apply the note title when exporting (the one that appears in the first line beside the yellow note icon in zotero desktop app)

    Thanks :)
This discussion has been closed.