# @citation-js/cli 中文文档

规范地址：https://npmcn.com/package/%40citation-js/cli/

版本：0\.9\.0
npm 元数据更新时间：2026-09-18T11:14:44.736Z
中文译文更新时间：2026-11-09T17:00:28.750Z
软件包许可：MIT

本文由上游 README 翻译，可能存在偏差，请结合原文核对 API、命令与配置。版权与许可归原作者所有。

原始 npm 页面：https://www.npmjs.com/package/%40citation-js/cli
原文对照：https://npmcn.com/package/%40citation-js/cli/?lang=original
项目主页：https://citation.js.org/
源码仓库：https://github.com/citation-js/citation-js

## 关键信息（来自 npm 元数据）

- 包体积（解压后）：13.5 kB，4 个文件
- 模块格式：CommonJS
- TypeScript 类型：未声明
- Node.js 要求：\>=22\.12\.0
- 运行依赖：8 个
- 首次发布：2018-12-06T20:51:34.780Z
- 最新版本发布：2026-09-18T11:14:44.565Z
- 近 30 天下载量：25580（2026-10-10 至 2026-11-08，npm 官方下载统计）
- 已发布版本数：73（近 12 个月 5 个）

## 中文简介

引用的CLI.js

## 安装

```sh
npm install @citation-js/cli
```

也可以使用：`pnpm add @citation-js/cli`、`yarn add @citation-js/cli`、`bun add @citation-js/cli`

## README

# @ 引用-js/cli

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

## [![NPM version](https://img.shields.io/npm/v/@citation-js/cli.svg)](https://npmjs.org/package/@citation-js/cli) [![NPM total downloads](https://img.shields.io/npm/dt/@citation-js/cli.svg)](https://npmcharts.com/compare/@citation-js%2Fcli?minimal=true) ![License](https://img.shields.io/npm/l/@citation-js/cli.svg) ![Dependency status](https://img.shields.io/librariesio/release/npm/@citation-js/cli)

## 安装

```
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-type` | `json` | `json`, (中文(简体) ), `string` |
| `-s, --output-style` | `csl` | `citation-*`, (中文(简体) ), `bibtex`, (中文(简体) ), `bibtxt`, (中文(简体) ), `data` |
| `-l, --output-language` | `en-US` | `es-ES`, (中文(简体) ), `fr-FR`, (中文(简体) ), `du-DU`, (中文(简体) ), `nl-NL` |

例如,格式化 [doi:10.5281/zenodo.1005176 (英语)](https://doi.org/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 是什么？

引用的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 和提交记录判断。

