Citr[js] — Markdown Citations made easy
Citations, just like footnotes, are difficult to implement and handle in Markdown documents. There are many freedoms and forms of speech one must expect when it comes to automatically handling citations inside Markdown documents. Albeit the format has been specified by Pandoc-Citeproc , there are still many edge cases that make it hard to deal with such citations, even if you just need to retrieve a certain citekey or want to quickly analyse something.
Zettlr Citr brings to you the algorithm that pandoc-citeproc uses to help you in a lot of cases:
- Do you want to implement citations on your website? Then simply use Citr as an interface between your texts and citeproc-js.
- Do you need a quick'n'dirty list of all citations within a given text to retrieve, e.g., the full bibliography needed for the references chapter? Citr offers a utility function for that as well.
- Do you need to automate the process of generating Markdown citations for a lot of works that are only present in a literature database (CSL JSON)? Then feed them all to Citr and it will give you ready-to-use Markdown citations.
Install it simply with NPM:
$ npm install @zettlr/citr
… or with Yarn:
$ yarn add @zettlr/citr
After installing, you have four powerful functions at your disposal that you can use:
Citr.parseSingle(markdown) // Parses a single citation from Markdown to CSL JSON Citr.makeCitation(csl) // Converts a CSL JSON citation to Markdown Citr.util.extractCitations(text) // Extracts all citations from a text Citr.util.validateCitationID(key) // Validates a given citation key