New plugin: Citations (with Zotero)

Hi all,

I’ve just released a very minimal Citations plugin for Obsidian. You can find it in the third-party plugins browser within the app.

Right now I’ve just implemented the feature most important to me, which is quick within-Obsidian search of a reference database. You can automatically create literature notes for a particular reference according to your own templates.

I’ve developed this for use with Zotero to start, but it could work right now with any reference manager that can export to CSL-JSON. You can find setup instructions in the GitHub readme.

Lots more features I would like to add in time, including…:

  1. Open papers from the search dialog
  2. Automatically copy PDF annotations from Zotero into a new note, without leaving Obsidian
  3. Peek at a paper’s abstract from within the search dialog
  4. Pretty-render paper references in Obsidian Preview mode as full APA/etc. citations

Let me know if it works (or doesn’t) for you, and what other features you’d be interested in seeing!

29 Likes

thank you this is exactly what I was looking for! I have it working, currently using this template for new notes:

---
tags: (#lit)
---

{{title}}
{{authorString}}
{{year}}

I would love to also include the publication / journal in the template.

Is it possible to also include a link to the zotero item and/or pdf?

3 Likes

Hi jgauthier, thanks for your citations plugin. I’ve tried but it doesn’t work: surely, I do something wrong.
Schermata 2020-12-10 alle 10.07.03

I’ve saved file in the vault.

If a press alt + ctrl + O or I, i can find any citation

Where do I wrong?

Thanks
Massimiliano

1 Like

Does that also mean that you’re planning to add a feature to insert references itself in markdown quotation style [@Paper2020, 123]? That would be very interesting, because it would implement a solution for what I have hacked together here: How I enter citekey references in Obsidian using the terminal

2 Likes

Hi @Max73!
Did you put full name to your file like
/Users/daniel/Dropbox/Zettlekasten/My Library.json
Or only
/Users/daniel/Dropbox/Zettlekasten

You should insert path to the file there

Hi @jgauthier great plugin!
Do you consider change “Citation export path” to “Citation database path (Better CSL JSON)” , it could be less ambiguous to newer users?

2 Likes

Hi @echej, thanks!!! Now it works!! :wink:

Hi @echej, thanks!!! Now it works!! :wink:

I just released a version 0.2.0 with the following changes:

New features:

  • Library is auto-reloaded whenever the export file is updated, no Obsidian refresh necessary

Minor changes:

  • Clarified configuration setting re: literature note paths. The new version presents a simpler option, ‘Literature note folder.’ Existing users will have to reconfigure with this new setting.
  • “Insert citation” hotkey default changed to Ctrl-Shift-E, since the former overlapped with the default Obsidian console hotkey
2 Likes

in 0.2.0 version picked references doesn’t appear in obsidian (in the previous version it worked, I am on Obsidian 0…9.20, MacOS Big Sur)

1 Like

Hi, looks like you’re not the only one with this issue, though I can’t reproduce it on my end. Can you try to reproduce the issue while the Obsidian developer console is open (Ctrl+Shift+I) and tell me whether you see any errors appear there?

This issue should be resolved in the latest release (0.2.1, just pushed).

1 Like

I have the same problem. I installed the 0.2.1. version. But the problem remains. I also use MacOS Big Sur and Obsidian 0.9.20.

Unfortunately I can’t reproduce the issue over here, so this must be a platform-specific thing. Can you open the Obsidian developer console (Ctrl+Shift+I), reproduce the bug, and let me know if any errors appear in the console? Thanks!

This appears when I digit ctrl+shift+E:

index.html:1 Uncaught (in promise) Error: ENOENT: no such file or directory, open ‘/Users/username/Documents/Zettelkasten/Literature notes/@kierkegaardBegriffAngst1984.md
Promise.then (async)
eval @ main.ts:165
step @ tslib.es6.js:102
eval @ tslib.es6.js:83
eval @ tslib.es6.js:76
__awaiter @ tslib.es6.js:72
CitationPlugin.insertLiteratureNoteLink @ main.ts:162
InsertCitationModal.onChooseItem @ modals.ts:82
t.onChooseSuggestion @ app.js:1
t.selectSuggestion @ app.js:1
e.useSelectedItem @ app.js:1
(anonymous) @ app.js:1
e.handleKey @ app.js:1
e.onKeyEvent @ app.js:1

This when I digit ctrl+shift+O:

Uncaught (in promise) Error: ENOENT: no such file or directory, open ‘/Users/username/Documents/Zettelkasten/Literature notes/@kierkegaardBegriffAngst1984.md
Promise.then (async)
eval @ main.ts:159
step @ tslib.es6.js:102
eval @ tslib.es6.js:83
eval @ tslib.es6.js:76
__awaiter @ tslib.es6.js:72
CitationPlugin.openLiteratureNote @ main.ts:156
OpenNoteModal.onChooseItem @ modals.ts:66
t.onChooseSuggestion @ app.js:1
t.selectSuggestion @ app.js:1
e.useSelectedItem @ app.js:1
(anonymous) @ app.js:1
e.handleKey @ app.js:1
e.onKeyEvent @ app.js:1

Wait, you know what? I created a “Literature Notes” folder in the Obsidian vault, and then it worked!

2 Likes

I will try!

Clarified configuration setting re: literature note paths. The new version presents a simpler option, ‘Literature note folder.’ Existing users will have to reconfigure with this new setting.

This really confused me since nowhere in the config panel I couldn’t find this option

It would be great if you could insert the Zotero path as a placeholder in the Literature Note Template, like this: Kierkegaard. 1992. Der Begriff Angst.

1 Like

Unfortunately the plugin doesn’t work if you have “:” in your citekey (e.g. @Name:2020), because it can’t create a literature note within obsidian. But that can probably not be fixed on your side. So I guess, I have to remove all “:” from my citekeys.

Another problem I stumbled upon: If I try to insert the link for this source, an error is produced:

@misc{Saraceno,
	author         = {Saraceno, Tom\'{a}s},
	howpublished   = {Fotografien der Installation},
	title          = {In Orbit},
	url            = {http://www.tomassaraceno.com/projects/in-orbit},
	urldate        = {2017-06-06}
}

{
"URL": "http://www.tomassaraceno.com/projects/in-orbit",
"accessed": {
  "date-parts": [
    [
      2017,
      6,
      6
    ]
  ]
},
"author": [
  {
    "family": "Saraceno",
    "given": "Tomás"
  }
],
"id": "Saraceno",
"publisher": "Fotografien der Installation",
"title": "In Orbit",
"type": "no-type"
},

Error:

Uncaught (in promise) TypeError: Cannot read property 'toString' of null
at CitationPlugin.getTitleForCitekey (eval at <anonymous> (app.js:1), <anonymous>:388:30)
at CitationPlugin.getPathForCitekey (eval at <anonymous> (app.js:1), <anonymous>:392:26)
at CitationPlugin.eval (eval at <anonymous> (app.js:1), <anonymous>:411:37)
at step (eval at <anonymous> (app.js:1), <anonymous>:70:23)
at Object.eval [as next] (eval at <anonymous> (app.js:1), <anonymous>:51:53)
at eval (eval at <anonymous> (app.js:1), <anonymous>:44:71)
at new Promise (<anonymous>)
at __awaiter (eval at <anonymous> (app.js:1), <anonymous>:40:12)
at CitationPlugin.getOrCreateLiteratureNoteFile (eval at <anonymous> (app.js:1), <anonymous>:406:16)
at CitationPlugin.eval (eval at <anonymous> (app.js:1), <anonymous>:437:22)
1 Like

Thanks @phlind for the bug reports!

  1. “:” in citekey: Hmm, I think it might be good to automatically convert characters that would produce an invalid filename into underscores or something. Will think about this one more, though.
  2. This will be fixed in the next version. This error is triggered because the entry is missing a year.
1 Like

@jgauthier Thanks for your answer. I now changed all citekeys to be without “:”. Probably it would be better for the plugin not to convert, but to display an error, so that the keys can be consistent.

Btw: Did you see my post above? It would be great to have another shortcut to enter just the citekey in pandoc format [@citekey]. Would be nice for people who directly write parts of papers or books in Obsidian.

1 Like