Google Docs Plugin: Replace citations with Zotero URIs

Hi @adomasven

Would you be open to a PR on the Google Docs Plugin that added a function:

"Replace citations with Zotero URIs”

This would work like "Switch..." but instead of inserting the item CSL, it would just replace the Zotero URI (e.g., and replace the anchor with it.

I could also build a “Restore citations from Zotero URIs” (if you felt that was helpful). In that case the Zotero URI would retain the citation code ( so that the citations can be restored.

We could obviously do this through a separate plugin - hence checking whether this would be of interest within the existing plugin!

Many thanks!
  • What is your use case here?
  • The use-case is linking from the document to (1) either to a public Zotero library (via the Zoteri URI, e.g., or to a (2) Kerko-library (

    Just having the first version is ok - once the link is inserted, it's easy to write a google docs script to convert that link to kerko links.

    The outcome of this process is that you then have a document (e.g. as PDF) which has links to a public Zotero library, where people can look up the abstract.

    Examples here: Have a look at this doc, et al. - 2020 - The Maldives and Sri Lanka Question & Answer Sess.pdf, page 7. You'll see two links, that take you back to

    More broadly, this is part of an basic "citation tree" effort: We want to have a record of what was cited in what document, and give the reader easy access to the citation, which means, e.g., accessing the references in digital format (e.g. on a public group so that they can be cited again, but also building up citation graphs.

    Even more broadly, we're using Zotero to manage our research outputs and citations, using Kerko to run our 'Evidence Library' here:

    Does that help?

    PS. @dlesieur is helping us with kerko. We're hoping to build a citation tree function very soon. The various tools (also including a Zotero CLI, a Zenodo CLI and a Zotero plugin are here If there's interest in our workflow, David and I would be super-happy to run a webinar / Q&A session etc. We've love to find some collaborators as well.
  • Even for document transfer between Google Docs and Word we considered putting the menu option for switching processors somewhere more secluded (like adding an Advanced section to Document Preferences), because the option is relatively rarely needed in contrast to the other ones. This seems an even more advanced feature, so I don't think we'd want to include it with our plugin. I recommend building it as a separate Chrome Extension that extends the Zotero Google Docs plugin. You'll probably want to reuse a lot of our Google Docs plugin code for that, but given how acquaintance you are with the platform most of it should be fairly self-evident.
  • Thank you @adomasven for the endorsement, but it really isn't straight forward to work out what's what. So much of what I know was hard earned through trial and error :)

    I am reluctant to clone the plugin. I hear you about the user interface - but code-wise, the addition is minimal.

    Could there be a compromise, where maybe there is an option in the advanced preferences, that changes how the 'Switch' option works? Something like: "Switch word processor inserts links to instead [tickbox]".

    Then it's out of the way, but stays part of the plugin? So basically, the compromise is that we include the function in the code (it should be very simple), but that we hide the option as much as possible. Would that be acceptable?
  • edited July 23, 2020
    Cited items don't need to exist in synced Zotero libraries, so this doesn't really make sense as a built-in option. If I'm understanding what you're trying to do, I would think you could write a script that would post-process a file with citations and substitute group links using the item key in the embedded metadata.
  • Sure - yes. We'll try to pull out the bit that gets the Zotero citations from the local Zotero library (I assume that's how it works) and integrate it into our workflow!
Sign In or Register to comment.