citation-js

Citation.js converts formats like BibTeX, Wikidata JSON and ContentMine JSON to CSL-JSON to convert to other formats like APA, Vancouver and back to BibTeX.
- Static
- Latest Patch
- Latest Minor
- Latest Major
- 0.7.18
- 0.7.17
- 0.7.16
- 0.7.15
- 0.7.14
- 0.7.13
- 0.7.12
- 0.7.11
- 0.7.10
- 0.7.9
- 0.7.8
- 0.7.7
- 0.7.6
- 0.7.5
- 0.7.4
- 0.7.3
- 0.7.2
- 0.7.1
- 0.7.0
- 0.6.9
- 0.6.8
- 0.6.7
- 0.6.6
- 0.6.5
- 0.6.4
- 0.6.3
- 0.6.2
- 0.6.1
- 0.6.0
- 0.5.7
- 0.5.6
- 0.5.5
- 0.5.4
- 0.5.3
- 0.5.2
- 0.5.1
- 0.5.0
- 0.4.10
- 0.4.9
- 0.4.8
- 0.4.7
- 0.4.6
- 0.4.5
- 0.4.4
- 0.4.2
- 0.4.1
- 0.4.0
- 0.3.4
- 0.3.3
- 0.3.2
- 0.3.1
- 0.3.0
- 0.2.15
- 0.2.14
- 0.2.13
- 0.2.12
- 0.2.11
- 0.2.10
- 0.2.8
- 0.2.7
- 0.2.6
- 0.2.5
- 0.2.4
- 0.2.3
- 0.2.2
- 0.2.1
- 0.2.0
- 0.5.0-alpha.10
- 0.5.0-alpha.9
- 0.5.0-alpha.8
- 0.5.0-alpha.7
- 0.5.0-alpha.6
- 0.5.0-alpha.5
- 0.5.0-alpha.4
- 0.5.0-alpha.3
- 0.5.0-alpha.2
- 0.5.0-alpha.0
- 0.4.0-12
- 0.4.0-11
- 0.4.0-10
- 0.4.0-9
- 0.4.0-8
- 0.4.0-7
- 0.4.0-6
- 0.4.0-5
- 0.4.0-4
- 0.4.0-3
- 0.4.0-1
- 0.4.0-0
- 0.3.0-14
- 0.3.0-13
- 0.3.0-12
- 0.3.0-11
- 0.3.0-10
- 0.3.0-9
- 0.3.0-8
- 0.3.0-7
- 0.3.0-6
- 0.3.0-5
- 0.3.0-4
- 0.3.0-3
- 0.3.0-2
- 0.3.0-1
- 0.3.0-0
Please use citation-js/citation-js if possible.
citation-js/citation-js | replaces | larsgw/citation.js |
---|---|---|
This repository contains the npm package @citation-js/core and several other components. |
This repository contains the npm package citation-js that wraps the aforementioned components for backwards compatibility. |
Install
On Node.js, install the package (citation-js) like this:
npm install citation-js
To install the CLI as a global command, do this:
npm install --global citation-js
Browser releases are available here. These define require
and add citation-js
as a module.
<script src="path/to/citation.js" type="text/javascript"></script>
<script>
const Cite = require('citation-js')
</script>
Getting Started
You can read a guide on how to get started, together with some tutorials and examples, here.
CLI
Run the CLI like this:
citation-js [options]
Options:
-h, --help output usage information
-V, --version output the version number
-i, --input <path> Input file
-u, --url <url> Input url
-t, --text <string> Input text
-o, --output <path> Output file (omit file extension)
-R, --output-non-real Do not output the file in its mime type, but as a string
-f, --output-type <option> Output structure type: string, html, json
-s, --output-style <option> Output scheme. A combination of --output-format json and --output-style citation-* is considered invalid. Options: csl (Citation Style Lanugage JSON), bibtex, citation-* (where * is any formatting style)
-l, --output-language <option> Output language. [RFC 5646](https://tools.ietf.org/html/rfc5646) codes
Cite
To use the Cite
constructor, require()
the module like this:
const Cite = require('citation-js')
For example, to get the bibliographical data of the Wikidata item wd:Q21972834
, and then format it in HTML, English and APA:
let example = new Cite('Q21972834')
let output = example.format('bibliography', {
format: 'html',
template: 'apa',
lang: 'en-US'
})
console.log(output)
To test this code, go to RunKit.
Async
Use the async API (recommended for Wikidata, URL, and DOI input) like this:
let example = await Cite.async('Q21972834')
let output = example.format('bibliography', {
format: 'html',
template: 'apa',
lang: 'en-US'
})
console.log(output)
Cite.async()
also supports options as the second argument, and a callback function as last argument.