A simple package for generating citations and bibliographies, wrapping the excellent
Download the package from NPM using
npm install --save simple-cite style-apa locale-en-us
yarn add simple-cite style-apa locale-en-us
// citation formatting configuration// localization configuration// a list of citable items with relevant metadataconst processor =itemsstylelocale
Citation objects may be made using the
cite method of the
Processor, providing a citation datastructure as argument:
const citation = processorcite citationItems: id: 'hawking1988'
Citation objects maintain the value of a citation registered with the processor within their
citationvalue// (Hawking, 1988)
This allows disambiguations to future citations and more to be made. For example, if we cite Lucy Hawking within the same context, we ought to disambiguate the authors according to the APA style. This would be tracked by the processor:
const lucyCitation = processorcite citationItems: id: 'hawking2000'lucyCitationvalue// (Lucy Hawking, 2000)citationvalue// (Stephen Hawking, 1988)
As such, it is important to remember that citation values may change while citations are being registered.
Bibliography object may be made using the
const bibliography = processor
Citation, this maintains the value of long form references for items previously cited by the processor with a
bibliographyvalue// Hawking, S. W. (1988). A brief history of time: from the big bang to black holes. Toronto: Bantam Books
Again, the value will update as citations are registered with the
In depth Usage
In addition to simple citations, in-narrative citations by adding an
"in-narrative" property to the citation:
const citation = processorcitecitationItems: id: 'hawking1988'properties: 'in-narrative': truecitationvalue// Hawking (1988)
Items to be included in bibliographies without explicit citation (no-cites) may be registered with the
noCite method, which takes an array of item ids as argument:
Citation data structures
Citation data is described according to the CSL-JSON schema.
A single bibliographic work or resource, such as an article, book or book chapter.
An item is represented as an object, with a required
id field (analogous to the BibTeX cite-key) and
type field (analogous to the BibTeX entry type).
Further metadata, such as authors, date of issue etc. may be included with appropriate fields.
An example would be:
These data are most easily generated using a compatible citation manager, such as Zotero.
A cite-item corresponds to a single in-document reference to an item via matching id property, with optional
suffix annotations, and the option to not include reference to the author (
"suppress-author") or include only the author (
A citation corresponds to a collection of cite-items referenced at a single point within a document, with a properties object providing metadata about the citation within the text, for example the index of the footnote in which it is located (if using a "note"-based citation style).
The CSL style may be specified using either the XML-based Citation Style Language, or a derived JSON representation.
The CSL locale may be specified in the same way, and obtained from the official CSL locale repository, or obtained from NPM under the scope