GithubHelp home page GithubHelp logo

sjml / csl-json-citation-picker Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 88 KB

Home Page: https://marketplace.visualstudio.com/items?itemName=ShaneLiesegang.csl-json-citation-picker

License: MIT License

JavaScript 100.00%

csl-json-citation-picker's Introduction

CSL JSON Citation Picker

I like using Zotero to manage my research references, but I mostly write in Markdown, so the Word/Google Docs plugins are not as useful to me. There is a VS Code plugin for Zotero that is pretty popular and has a very slick interface, but I faced a couple issues with it:

  1. It requires Zotero to be running. I mostly use it to manage citations and export them to a bibliography file which doesn't change much, so it's annoying to have an extra app open for writing.
  2. The UI for it seemed very laggy, even on my pretty fast computer. I don't know if it's because it has to communicate over a local network connection or the UI toolkit is slow, but it just bugged me.
  3. The Zotero app (which has to be running, as we've said) steals focus after every cite insertion.

All very mild annoyances, to be sure, but I couldn't shake the feeling that there had to be a better way to grep through just a megabyte or so of structured text. So I made this thing. Like the other extension, it also leverages the Better BibTeX extension for Zotero itself, but it only relies on the exported files that BBT keeps in sync, so the app itself is out of the loop. (Presumably, if you have some other source of generating CSL JSON files, you don't need Zotero at all. But it's what I use.)

NOTE: this only works with exported CSL JSON files, not with .bib files. It probably would not be too hard to get this working with BibTeX, but JSON is super easy for JavaScript to ingest, and I was already using it anyway because of its better metadata export.

Usage

  • Make sure to set the csl-json-citation-picker.libraryPath property to point to you local library export. For me, that's ~/Documents/Zotero_Library.json.
  • Then, when you're working on a document and want to insert a citation, open the command palette and select "Insert Citation" or you can use the default keyboard shortcut of Alt-Shift-Z. (Option-Shift-Z on a Mac.) That brings up an input where you can enter a search term.
  • It will search your library for titles, authors, notes, and keywords matching the search term, and give you back a list you can choose from.
  • Pick one of those and the citation key will be inserted at your current edit point.
  • That's it!

It probably is missing a lot of features that the Zotero picker offers, but honestly I wasn't using them anyway, and this just works faster.

Caveats

  • This is quick and dirty. Probably bugs, but it's worked for me so far.
  • It does not automatically pick up changes to the JSON file. (On my todo list, but not high up.) There is a "Reload Citation Library" command that should do the trick if you invoke it manually, though. On VS Code startup it will reload the files, too.
  • It would be nice if there was some kind of live search (like the other extension has), but I can't see a way to hook that into VS Code's UI. You can only use a text input or a picker, but not both. :(

csl-json-citation-picker's People

Contributors

sjml avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.