Clone wiki

citeproc-js / Highlights

What's citeproc-js?


Citeproc-js is a citation formatter based on the Citation Style Language (CSL). Originally built for use in Zotero ('the popular bibliographic management plugin for the Firefox web browser), citeproc-js is a standalone Javascript module that can be run in other contexts as well: as a browser plugin serving or embedded in other extensions; as an embedded utility in a server-side or desktop application; or as the core of a citation formatting web service.

Zotero already had a CSL processor when this project was started. It was occasioned by a discussion on the zotero-dev list, in which several people signalled that a standalone rewrite of the existing Zotero citation processor would be welcome. The catalyst of temptation was a post by Erik Hetzner, offering example code for a more modular implementation.

The processor code base started showing signs of being useful during the summer of 2009, when Bruce D'Arcus and Rintze Zelle began working on changes to the schema for a CSL 1.0 release. The processor was progressively adapted to the CSL 1.0 schema as it emerged, and was released in parallel with the finalized CSL schema. Thanks to extensive feedback from users and developers at Mendeley and Zotero, in particular, the processor can now be considered quite stable.


Since Zotero already had a CSL processor, why go out of the way to build this one? Here are a few of the reasons that seemed to make sense early in 2009, and are not sufficiently embarrassing at this later point in time to justify their concealment:

To separate the CSL processor from Zotero: The Web is all about cross-referencing, and cross-referencing is what citation conventions are for. There is great potential utility in a general tool for generating formatted references and bibliographies on the Web, so building on the work of Zotero by spinning the CSL formatting engine out into a separate standalone module seemed like a good idea.

To build a well-tested system: This isn't specifically a reason for building a separate processor, but it was certainly an early objective once the work got underway. Citation styles are very complex, and it's a good thing to catch problems before they are reported by users. The test suite for citeproc-js is pretty good, and if new problems are discovered, they can be reduced to tests so that they stay fixed through future revisions to the code.

To be helpful, and a little meddlesome: Zotero is a great tool that has come along very quickly. Still (and even setting aside the lawsuit filed by Thompson Reuters) the project does not enjoy infinite funding, and its developers do not enjoy an infinite supply of time. Taking on the task of rebuilding the processor was a way of "putting something back". At the same time, the work provided a platform for pushing forward and assist on some of the important features that I wanted to see in Zotero for my own work in comparative law, such as footnote backreferencing, the "five-footnote rule", parallel citations, and multi-lingual support.

To construct a CSL 1.0 compliant processor: During the push toward CSL 1.0 that began in the Summer of 2009, chasing the functionality being defined in the new standard became the main focus of citeproc-js development. The careful logic of enhanced functionality in CSL 1.0 and its complete implementation in citeproc-js, has been good for both projects.