@citation-js/plugin-cff

中文文档
0.7.3发布于 2026/10/01MITTypeScriptES Module近 30 天下载 2.8万

Citation.js plugin for the Citation File Format (CFF)

原始使用文档
文档目录7 节
  1. Install
  2. npm
  3. Browser
  4. Use
  5. Formats
  6. Input
  7. Output

This plugin adds support for Citation File Format (CFF) files, both as YAML and in the non-standard JSON form.

Install

npm

npm install @citation-js/plugin-cff

Browser

Make a build with @citation-js/plugin-cff on the build tool!

Use

Register the plugin by require-ing it:

require('@citation-js/plugin-cff')

Formats

Input

# Example from https://github.com/citation-file-format/citation-file-format#example

cff-version: 1.2.0
message: If you use this software, please cite it as below.
type: software
authors:
  - family-names: Druskat
    given-names: Stephan
    orcid: https://orcid.org/0000-0003-4925-7248
title: My Research Tool
version: 1.0.4
doi: 10.5281/zenodo.1234
date-released: 2017-12-18

becomes

{
  author: [ { family: 'Druskat', given: 'Stephan' } ],
  issued: { 'date-parts': [ [2017, 12, 18] ] },
  DOI: '10.5281/zenodo.1234',
  title: 'My Research Tool',
  version: '1.0.4',
  type: 'book',
  _cff_mainReference: true
}

Output

If you pass multiple references the first counts as the main reference, while the rest are added in the references list. To specify a different entry as the main reference, pass the entry ID in the main option:

Cite(/* ... */).format('cff', {
  main: '...'
})

Alternatively, the entry can have _cff_mainReference set to true, but that is mainly used for round-tripping.

To specify the preferred citation, pass the entry ID in the preferred option.

To generate CFF 1.1.0 output, pass '1.1.0' to the cffVersion option.

You can also specify the message, a mandatory part of every CFF file. By default, the message is:

Please cite the following works when using this software.

To change it, pass a string to the message option when formatting:

Cite(/* ... */).format('cff', {
  message: 'If you use this software, please cite it as below.'
})

版本与发布记录

@citation-js/plugin-cff 共发布 6 个版本,首次发布于 2023/03/27;过去 12 个月发布了 5 个版本。

版本发布日期距今
0.7.3latest2026/10/011 个月前
0.7.22026/09/201 个月前
0.7.12026/09/111 个月前
0.7.02026/09/111 个月前
0.6.22026/01/169 个月前
0.6.12023/03/273 年前

关于 @citation-js/plugin-cff 的常见问题

@citation-js/plugin-cff 是什么?

Citation.js plugin for the Citation File Format (CFF)

如何安装 @citation-js/plugin-cff?

在项目目录运行 npm install @citation-js/plugin-cff,或使用 pnpm add / yarn add / bun add。

@citation-js/plugin-cff 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@citation-js/plugin-cff 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@citation-js/plugin-cff 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=22.0.0。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@citation-js/plugin-cff 可以商用吗?

@citation-js/plugin-cff 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@citation-js/plugin-cff 的下载量有多少?

根据 npm 官方下载统计,@citation-js/plugin-cff 在 2026/10/10 – 2026/11/08 这 30 天内被下载 28,462 次,日均约 949 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@citation-js/plugin-cff 还在维护吗?

最新版本 0.7.3 发布于 2026/10/01(1 个月前);至今共发布 6 个版本,其中过去 12 个月发布了 5 个;首次发布于 2023/03/27。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。