@citation-js/cli

中文文档
0.9.0发布于 2026/09/18MITCommonJS近 30 天下载 2.6万

引用的CLI.js

中文使用文档
文档目录5 节
  1. 安装
  2. 使用量
  3. 投入
  4. 产出
  5. 输出格式

@ 引用-js/cli

引文使用过时参数coauthors (帮助) CLI for Citation.js.

NPM version NPM total downloads License Dependency status

安装

npm install --global @citation-js/cli

使用量

Usage: citation-js [options]

Options:
  -h, --help                         output usage information
  -V, --version                      output the version number

  -i, --input <path>                 Input file. If all input options are omitted, it uses stdin
  -t, --text <string>                Input text. If all input options are omitted, it uses stdin
  -o, --output <path>                Output file (omit file extension). If this option is omitted, the output is written to stdout
  --pipe                             Pipe and transform from stdin to stdout

  -R, --output-non-real              Output as a text file
  -f, --output-type <option>         Output structure type: string, html, json (default: "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) (default: "csl")
  -l, --output-language <option>     Output language. [RFC 5646](https://tools.ietf.org/html/rfc5646) codes (default: "en-US")

  --log-level <level>                Log level: silent, error, warn, info, debug, http (default: "warn")

  --plugins <names>                  Plugin names (@citation-js/plugin-NAME); bibjson, bibtex, csl, doi, ris & wikidata are preloaded (default: [])
  --plugin-config <config>           @plugin.property.path=value;... (default: [])
  --formatter-options <config>       property.path=value;... (default: [])

  --no-input-generate-graph          Do not include the parsing graph in CSL output
  --input-force-type <type>          Force parsing as a certain type
  --input-max-chain-length <number>  Set the maximal number of parsing iterations
  --no-input-strict                  Do not use the strict parsing mode
  --input-target <type>              Stop parsing when a certain type is reached

投入

输入可以从 stdin,作为文件通过 -i, --input <path> 或者,对于简单的ID,作为纯文本 -t, --text。 。 。 .

$ echo "Q30000000" > input.txt

$ cat input.txt | citation-js
[{"title": "The Synergistic Activity ...", ...}]

$ citation-js --input input.txt
[{"title": "The Synergistic Activity ...", ...}]

$ citation-js --text Q30000000
[{"title": "The Synergistic Activity ...", ...}]

产出

CLI 输出到 stdout 默认情况下,但可以写入文件 -o, --output 选项.

$ citation-js --text Q30000000
[{"title": "The Synergistic Activity ...", ...}]

$ citation-js -t Q30000000 -o output
$ more output.json
[{"title": "The Synergistic Activity ...", ...}]

注意:文件扩展名是自动确定的,因此应在 -o 选项。 要强制文件扩展名, 只需省略 -o 并重定向 stdout 以至首选文件.

输出格式

要格式化输出,请使用 -R, (中文(简体) ), -s, (中文(简体) ), -f 财务报告和审定财务报表 -l 选项。 这些选项映射到旧输出选项 .

CLI 选项默认值其他价值
-R, --output-non-real省略(real(中文(简体) )现( u)string,纯文本)
-f, --output-typejsonjson, (中文(简体) ), string
-s, --output-stylecslcitation-*, (中文(简体) ), bibtex, (中文(简体) ), bibtxt, (中文(简体) ), data
-l, --output-languageen-USes-ES, (中文(简体) ), fr-FR, (中文(简体) ), du-DU, (中文(简体) ), nl-NL

例如,格式化 doi:10.5281/zenodo.1005176 (英语) 以APA格式用法语:

$ citation-js -t 10.5281/zenodo.1005176 -f string -s citation-apa -l fr-FR

Willighagen, L., & Willighagen, E. (2017,  octobre 9). Larsgw/Citation.Js V0.3.3. Zenodo. https://doi.org/10.5281/zenodo.1005176

版本与发布记录

@citation-js/cli 共发布 73 个版本,首次发布于 2018/12/07;过去 12 个月发布了 5 个版本。

版本发布日期距今
0.9.0latest2026/09/181 个月前
0.8.22026/07/133 个月前
0.8.12026/07/064 个月前
0.8.02026/07/064 个月前
0.7.222026/01/0110 个月前
0.7.212025/10/201.1 年前

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

@citation-js/cli 是什么?

引用的CLI.js

如何安装 @citation-js/cli?

在项目目录运行 npm install @citation-js/cli,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 citation-js,可以用 npx citation-js 直接运行。

@citation-js/cli 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/citation-js__cli 是否存在。

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

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

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

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

@citation-js/cli 可以商用吗?

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

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

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

@citation-js/cli 还在维护吗?

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