@citation-js/plugin-doi

中文文档
0.9.0发布于 2026/09/18MITTypeScriptESM + CJS近 30 天下载 3.6万

Plugin for DOI input for Citation.js

原始使用文档
文档目录5 节
  1. Install
  2. Usage
  3. 'Polite' API access
  4. Formats
  5. Input

@citation-js/plugin-doi

Plugin for DOI input for Citation.js.

NPM version NPM total downloads License Dependency status

Install

npm install @citation-js/plugin-doi

Usage

Register by importing the package:

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

'Polite' API access

The plugin fetches data from DOIs using DOI Content Negotiation, which means the Crossref, DataCite, and mEDRA APIs are indirectly used.

Crossref strongly encourages adding a mailto: link to the User-Agent header or URL parameters to get higher rate limits. Because the Crossref API is only used indirectly, the URL parameter method cannot be used consistently. Additionally, the User-Agent header cannot be set in the browser. For non-browser usage however, the user agent can be set like this:

const { util, version } = require('@citation-js/core')

util.setUserAgent(`Example Foo (mailto:[email protected]) Citation.js/${version} Node.js/${process.versions.node}`)

Formats

Formats and other features added by this plugin.

Input

Supports DOIs inputted in the following ways:

  • @doi/api: a doi.org URL
  • @doi/id: a single DOI
  • @doi/list+text: whitespace-separated list of DOIs
  • @doi/list+object: array of DOIs

Additionally, the following internal type is exposed:

  • @doi/type: fix the type value in certain API responses

版本与发布记录

@citation-js/plugin-doi 共发布 54 个版本,首次发布于 2018/12/07;过去 12 个月发布了 4 个版本。

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

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

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

Plugin for DOI input for Citation.js

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

在项目目录运行 npm install @citation-js/plugin-doi,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:@citation-js/core(^0.9.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

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

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

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

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

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

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

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

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

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

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

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

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