Package Exports
- @citation-js/core
- @citation-js/core/lib-mjs/index.js
- @citation-js/core/lib/index.js
- @citation-js/core/lib/plugin-common/input
- @citation-js/core/lib/plugin-common/input/index.js
- @citation-js/core/lib/plugin-common/output
- @citation-js/core/lib/plugin-common/output/index.js
- @citation-js/core/lib/plugins/input/csl.js
- @citation-js/core/package.json
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@citation-js/core) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
@citation-js/core
Convert different bibliographic metadata sources.
Install
npm install @citation-js/core
Usage
Getting Started
You can read a guide on how to get started, together with some tutorials and examples, here.
Cite
To use the Cite
constructor, require()
the module like this:
const {Cite} = require('@citation-js/core')
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.