Zotero integrations

The plugin will have to do some caching of the cite keys as the .bib/CSL JSON updates. Hopefully the Plugin API will have hooks to the completion UI/logic for the current link completion, then the cache can be used there. That would satisfy the idea of the cite key as being a node as well.
I have to mention though that pandoc-style markdown citations are [@key] as opposed to [[@key]]. So any export functionality should provide an option to keep the one pair of brackets I guess (there is a thread over at Feature requests asking for a way that automatically removes both the pairs of brackets on export).

1 Like

I went onto the Zotero forums and asked, What do app developers need to do to “keep the door open” for full Zotero integration? I wanted to know if there was anything that Obsidian developers might wish they’d known early on if they’re interested in eventually having the kind of awesome, polished, “first-class” Zotero integration that is currently enjoyed only by MS Word, LibreOffice, and Google Docs.

(Zettlr, Sublime Text, and some other apps have integration too, but the UX isn’t on the same level as the type of integration in MS Word, LibreOffice, and Google Docs. If you don’t care about the difference between first- and second-class Zotero integration, then that’s fine. I’m not going to tell you what you should care about. More broadly, I’m not going debate the value of UX here. Sorry if this comes off as defensive, I’m just very tired of this particular conversation.)

The first responses I got were from a couple Zotero devs who are regulars on their forums. They said that Zotero has tons of extension points, and that they’re more than willing to help anybody who comes and asks questions – which is obviously great!

I tried coming at the question of “What can be done to make it as easy as possible?” from a few different directions. This briefly frustrated them because they felt like there was little more to add than to reassure me that nothing special needs to be done, no deal with Zotero needs to be struck, and that there’s no general advice to be given. Basically, it just takes a little time and work, and they didn’t have anything else to say. They agreed to this summary:

Anybody who wants Zotero integration for their project can have it. It can work like it does in MS Word, or it can work like it does in Zettlr. There’s no need to do anything weird or special to get it working. There are ample extension points in Zotero, and the devs are happy to answer questions.

I was about ready to settle for that, but then one of the devs who actually works on the kind integration I was talking about showed up. His insight was much more specific:

To chime in from an actual dev of the “first-class” integrations. Firstly, we have the docs which, while maybe not the best formatted and crystal clear, should at least give a good idea for doc editor developers on what they need to prepare for to be able to provide a Zotero plugin, and if that fails, we answer questions on zotero-dev. In fact, I know TextMaker is planning to release (or perhaps has already released) a fully functional “first-class” Zotero integration in their editor, to my knowledge without ever getting any support from Zotero devs.

Secondly, most of the work in providing Zotero integration plugin is not in talking to Zotero, but in implementing the actual logic. Zotero requires 2 specific functionalities from the document format:

  1. You must be able to associate metadata with parts of the text that are Zotero citations . Zotero needs to know which parts of the document are its citations and be able to store metadata required to update them. In Word it’s Fields, in LibreOffice it’s ReferenceMarks and in Google Docs it’s madness-fueled NamedRanges and links.
  2. You must be able to store text location non-specific, i.e. global metadata in the document. This is where Zotero stores things like the citation style used by the document and other prefs.

Depending on how close to the metal of the original doc editor a plugin developer works, accessing these 2 functionalities of a doc editor can be super easy and convenient, which makes implementing the plugin also relatively easy, or enragingly frustrating and difficult. We would love to provide first-class integration for other popular document editing options, but we simply don’t have enough time to do that given how complicated it is and how much work it takes to simply maintain the 3 (actually 4, since mac word and win word do not share code) existing integrations.

So, I hope that the Obsidian devs see this so that they can at least keep it in the back of their minds. I’m crossing my fingers for “first-class” Zotero integration, and early considerations that’ll make that easy later will significantly increase the chances of getting it.

25 Likes

Going by what the MS Word integration provides, would first-class integration also involve generating a bibliography section in the markdown file itself?
Because I’m assuming all other functionality it provides, including auto-completion can be accomplished via the .bib/CSL file alone. This makes it agnostic of reference manager as well.

But then as in some of the replies in the Zotero thread, plain-text notetaking and Document preparation are 2 separate steps, pandoc being the converter between them, handling citation styles and the like. I do understand your idea of a (graphical) UX but do you see it feasible in Obsidian given that we can’t have block level access (it is but a .md file), hence can’t give access to specific areas of text to the plugin, like the other integrations? I see both the points mentioned by the dev are fundamentally violated by the plaintext philosophy of Obsidian. Zettlr’s UX in that sense is reasonable, though also plaintext, it has graphical export options which call pandoc and other command-line utilities in the background.

2 Likes

For Obsidian the best path would be something like Zettlr or Rmarkdown went

  1. Citation picker which could be reference manager independent:
  • Examples would be be used in Zelltr Citr or VSC Zotero Citation Picker
  • It would be great if the citation could link to pdf in the Zotero library (Zettlr could do that when using JSON )
  1. Full citation and bibliography could be rendered within preview (with some settings using Pandoc how they are rendered) the example would be preview within Rstudio, Zettlr is doing that differently by using a different pane
  2. In the distant future when Obsidian WISIWYG will exist it could be maybe combined in one view (but it’s will depends how the WISIWYG will be implemented)
2 Likes

As with most UX matters, I think taking a second to formulate a couple personas might be beneficial here.

Persona 1: Taylor

  • Age: 26
  • Profession: Software engineer.
  • Main goal: A place to record interesting thoughts to help explore curiosities and remember ideas for apps.
  • Likes: Using things in the way they are intended to be used.
  • Dislikes: Breaking our going outside of established standards.
  • Confused by: Why anybody would want any WYSIWYG functionality in apps that aren’t built to be WYSIWYG from top to bottom.
  • Quote: “Plaintext files are elegant because they’re strictly plaintext. If someone wants to do more than record and display plaintext, then they shouldn’t use a plaintext editor.”

Persona 2: Alex

  • Age: 37
  • Profession: Anthropology PhD candidate.
  • Main goal: A better way of organizing his knowledge to help write research papers.
  • Likes: Feeling like his tools are serving him instead of the other way around
  • Dislikes: When software gets in the way – especially when he’s told that the obstacle is a feature instead of a bug.
  • Confused by: Any code more complicated than the most basic parts of markdown formatting (italic, bold, headers, lists, and quotes).
  • Quote: “When the code helps me think, show the code. When it just makes things more opaque, hide the code. I just want to get across the finish line easily and efficiently.”

These are incredibly basic personas, but I think they’re enough to let us begin reasoning about what different kinds of users might want. Instead of saying vague things like “users will want to do X” (which makes the user into an elastic entity that stretches and bends to fit any ideas whatsoever), forcing ourselves to instead ask “What would Terry/Alex want?” will keep us focused on making sure that the way we are imagining features actually serves the goals of the users.

Anyway, I imagine that Terry and Alex would want different things here. Terry would probably want Obsidian to implement Zotero integration the same way that it’s done with Zettlr and Sublime Text. Meanwhile, Alex would probably rather it be done in the kind of live preview way that Typora renders everything, looking to the way that Zotero designed the plugins for MS Word, LibreOffice, and Google Docs for ideas about what a GUI control panel might look like.

I don’t think Terry is better than Alex or vice versa. They just have different goals and values. So, they want different things from Obsidian.

Perhaps there’s a way of approaching this that’ll let Terry and Alex both be happy. Maybe it’s as simple as having a preference toggle to switch between “Show the code in the editor” and “Render the output in the editor.” As an interaction designer, this is the solution that I’d recommend, but of course it depends on whether or not the programmers can figure out how to implement the idea.

Edit: If one of the Obsidian devs would like me to produce mockups of the solution I’m proposing (no, not just what the toggle would look like in the preferences; I mean mocking up what the functionality would actually look in both modes), then let me know. I care enough about this functionality that I’d be willing to put the time into doing this.

11 Likes
  1. These goals are not incompatible. The important points you are discussing @ SquareBottle are more general questions about how WYSIWYG from UX-point-view should be implemented, not specific to Zotero.

  2. I think Zotero plugin is quite low now on priority list of developers, the highest chance for getting it when someone will implement it after the API will be exposed.

  3. From the design objectives “Obsidian as Markdown editor” is quite unlikely we get something like Google Docs of MS Words. I want to have Obsidian with live markdown preview, but Google docs or MS Word Zotero implementation goes against plaintext philosophy - so clean LateX style citation with \cite{} or more markdown style @ (together with implemented citation picker) which could be rendered to actual citations/bibliography in WYSIWYG mode

  4. I agree that the most probable is a currently implemented solution about which @ SquareBottle write: >>having a preference toggle to switch between “Show the code in the editor” and “Render the output in the editor.”<<

4 Likes

So, is there any smooth way to cite using Zotero? Or now it is just better to use Zettlr for such purposes
Could someone please navigate me, since its seems pretty complicated for me as Mac user

I thought it was relatively easy to copy+paste citations from Zotero already into ant text app - from their manual:

“Zotero can also insert citations and bibliographies into any text field or program. Simply drag-and-drop items, use Quick Copy to send citations to the clipboard, or export them directly to a file.“

Is that not the case?

1 Like

+1 to this, would love to be able to autofill citekeys from a .bib file like you can in Zettlr. Hit @ and be able to auto complete your reference library

4 Likes

I also discovered the zotero-roam-export plugin a few weeks back and opened an issue about the markdown export. It didn’t look very promising, so I’ve since then spent some time writing a plugin for Zotero that works for my own workflow.

I only briefly used Zettlr, and so far I don’t see myself using Obsidian to write papers directly, so I don’t need the full citation powers that Zettlr offers (at least so far!). In my case, even pandoc has its limitations, which is why I end up writing the paper using LaTeX anyways. For me, Obsidian is useful to keep my (often private) notes, and relating ideas from what I’ve read or highlighted to some other idea that I’m working on, which is why I keep two different files for the same paper: one with my notes linking to the one with the information for Zotero (that way, if needed, I can fully rewrite the latter with a (newer) export, without losing my notes in the former).

The plugin I wrote is based on the zotero-roam-export plugin and in short, my plugin does the following:

  • Extracts metadata from the item and highlights from the PDF using Zotfile (similar to zotero-roam-export ) and saves it in a markdown file. I get one file for each item selected. I can save directly in my vault, and I can (optionally) choose to use cite keys (using Better Bibtex) as file names e.g. doe2020aaaa-zotero.md
  • Creates a file for my own notes based on the naming above (minus the suffix) doe2020aaaa.md , and transcludes the metadata, links to the highlights/annotations, and adds a header for my notes. This is the one I use to link when I refer to the whole paper and as a sort of table of contents around specific ideas of that paper, i.e. I can “cite” the paper as [[doe2020aaaa]] .
  • Adds all those files as linked attachments to the Zotero item, so that if I double click the markdown note is opened with the default markdown app from Zotero (if eventually the URL protocol is implemented, then the link can easily be switched to include obsidian:// ). This basically lets me go from one app to the other. In Obsidian, in the doe2020aaaa file I can write my own notes, and in preview mode I can also click on a link in that opens Zotero and selects the right item. In Zotero I can double click to edit my notes, or open it in Obsidian.

If this sounds like it might be useful to someone here, I can share the Zotero extension.
Disclaimer: This is my first time coding anything Javascript or Zotero-related and I can’t really guarantee that it will work well or efficiently. I learned a lot and reused some parts of the zotero-roam-export in order to get the plugin working for myself (so far so good).

Finally, I have a question for those that use Zettlr or want a Zettlr-like way to cite within Obsidian. What does your (expected) workflow look like? Do you use Zettlr/Obsidian to create PDFs and render citations? How would the citation in Obsidian look like? Do/Would you also create a note for the paper itself? And if so, when do you “cite” and when do you link to the note, i.e. [See @doe2020aaaa] vs See [[doe2020aaaa]] ?

Edit: Here’s the plugin https://github.com/argenos/zotero-mdnotes

The standalone post with my workflow (slightly updated since) is here: Zotero plugin to export metadata and notes to markdown

13 Likes

Wonderful job! Thanks a lot!

Zettlr has integration with auto-exported library file from Zotero. Basically, it offers suggestions once you start typing [@ in the editor. It’s convenient as a substitution for MS Word plugin, but the functionality is quite basic.

2 Likes

Hi, thanks for your sharing. I have downloaded your plugin and it works well.
How can you import these files into the Obsidian? I can drag the file into a new note in Obsidian and make it as an attachment. Is this the right way?

If you go to Tools > Mdnotes preferences you can set the path to your vault (or a folder within it) so that it’s the starting folder whenever you export anything. That’s just to set the starting path, so you don’t have to choose it manually each time, but in the end the notes will be exported on whichever path you choose.

1 Like

Great! It helps a lot.
Thanks for your prompt reply.

Wow ! really appreciate your work on hours of working for this zotero integration , ,i have installed them on Zotero and ,i have set the path folder where the obsidian vault folder for ZOTFILE ,BETTERBIBTEX and MDPREFRENCES.
I couldn’t comprehend beyond this ,for my capacity .
well i guess i am a bit thick skulled lol ,could there be any gif or some demonstration after this as an example file or folder ?(apologies if i am wasting your time ).

Do you mean something like this? Here is a small gif showing batch export as well.

After you’ve set your path, right click on the item you want to export (I added a small cheat sheet of what to select here). If you choose a path inside your vault during the export, you just need to go back to Obsidian and open the files there.

1 Like

Is it possible to adapt/reuse one of the plugins for Zettlr, Atom, Sublime? Adding bibliographical references is the only serious thing tha is currently missing.

Unfortunately, I have no idea. I think these are all different pieces of software so we’ll need to wait either until the guys at Obsidian implement it or they create an API / plugin interface so that other people can help with certain features’ implementation.

Meanwhile, there’s a universal Zotero picker for Windows, give it a go.

3 Likes

I am on Mac :slight_smile: , but thanks. I will keep copy/pasting bibtex codes.

Have you tried this method with Automator?

1 Like