Security News
Bun 1.2 Released with 90% Node.js Compatibility and Built-in S3 Object Support
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
citation-js
Advanced tools
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.
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. |
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>
You can read a guide on how to get started, together with some tutorials and examples, here.
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.
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.
FAQs
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.
The npm package citation-js receives a total of 1,312 weekly downloads. As such, citation-js popularity was classified as popular.
We found that citation-js demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
Security News
Biden's executive order pushes for AI-driven cybersecurity, software supply chain transparency, and stronger protections for federal and open source systems.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.