# @citestyle/bibtex 中文文档

规范地址：https://npmcn.com/package/%40citestyle/bibtex/

版本：1\.1\.0
npm 元数据更新时间：2026-05-29T18:58:22.567Z
中文译文更新时间：2026-11-09T22:01:02.297Z
软件包许可：MIT

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

原始 npm 页面：https://www.npmjs.com/package/%40citestyle/bibtex
原文对照：https://npmcn.com/package/%40citestyle/bibtex/?lang=original
项目主页：https://github.com/uniweb/csl/tree/main/packages/bibtex
源码仓库：https://github.com/uniweb/csl

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

- 包体积（解压后）：30.8 kB，7 个文件
- 模块格式：ES Module
- TypeScript 类型：包内自带
- Node.js 要求：\>=20\.19\.0
- 运行依赖：1 个
- 首次发布：2026-03-12T22:14:30.028Z
- 最新版本发布：2026-05-29T18:58:22.449Z
- 近 30 天下载量：2023（2026-10-10 至 2026-11-08，npm 官方下载统计）
- 已发布版本数：4（近 12 个月 4 个）

## 中文简介

BibTeX QQ CSL- JSON 解析器和序列器

## 安装

```sh
npm install @citestyle/bibtex
```

也可以使用：`pnpm add @citestyle/bibtex`、`yarn add @citestyle/bibtex`、`bun add @citestyle/bibtex`

## README

# @citestyle/bibtex (中文(简体) )

将 BibTeX 文件放入 CSL-JSON 并导出 CSL-JSON 返回 BibTeX 。 处理BibTeX真实世界的混乱: LaTeX口音命令, `@string` 缩写, `#` 相接相接相接相接相接相接相接相接相接相接相接相接相接相接相接相接相接相接相接相接相接相接相接相接相接相接相接相接相接相接相接相接相接相接相接相接相接相接相接相接相接相接相接相接相接相接相接相接相接相接相接相接相接相接相接相接相接相接相接相接相接相接相接相接相接相接相接相接相接相接相接相接相接相接相接相相接相接相接相接相接相接相相相接相接相相接相相相相相相相接相接相接相接相接相相相相相相接相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相相.

使用此选项将 BibTeX 引用带入 Citestyle 格式化管道, 或者导出格式化的 BibTeX 以与 LaTeX 用户共享 .

## 安装

```bash
npm install @citestyle/bibtex
```

## 解析 BibTeX 到 SSL- JSON

```javascript
import { parseBibtex } from '@citestyle/bibtex'

const bibtex = `
@article{smith2024,
  author = {Smith, John and de la Cruz, Maria},
  title = {A Study of {DNA} Replication},
  journal = {Nature},
  year = {2024},
  volume = {620},
  pages = {100--108},
  doi = {10.1038/example}
}
`

const items = parseBibtex(bibtex)

items[0].title                                // "A Study of DNA Replication"
items[0].author[0].family                     // "Smith"
items[0].author[1]['non-dropping-particle']    // "de la"
items[0].page                                 // "100-108"
items[0].DOI                                  // "10.1038/example"
```

## 导出 SSL- JSON 到 BibTeX

```javascript
import { exportBibtex } from '@citestyle/bibtex'

const output = exportBibtex([{
  id: 'smith2024',
  type: 'article-journal',
  title: 'A Study of DNA Replication',
  author: [{ family: 'Smith', given: 'John' }],
  issued: { 'date-parts': [[2024]] },
  'container-title': 'Nature',
  volume: '620',
  page: '100-108',
  DOI: '10.1038/example',
}])

// @article{smith2024,
//   author = {Smith, John},
//   title = {A Study of DNA Replication},
//   journal = {Nature},
//   year = {2024},
//   volume = {620},
//   pages = {100--108},
//   doi = {10.1038/example}
// }
```

## 全程: BibTeX 到格式化的书目

```javascript
import { parseBibtex } from '@citestyle/bibtex'
import { createRegistry } from '@citestyle/registry'
import * as apa from '@citestyle/styles/apa'

const items = parseBibtex(readFileSync('references.bib', 'utf-8'))

const registry = createRegistry(apa)
registry.addItems(items)

const bibliography = registry.getBibliography()
bibliography.forEach(entry => {
  console.log(entry.html)   // Semantic HTML with CSS classes and linked DOIs
  console.log(entry.text)   // Plain text for copy-paste
})
```

## LaTeX 到 Unicode 转换

```javascript
import { convertLatex } from '@citestyle/bibtex'

convertLatex('Universit\\"at M\\"unchen')   // "Universität München"
convertLatex('Sch\\"onfinkel')               // "Schönfinkel"
convertLatex('{\\ss}')                       // "ß"
convertLatex('\\o')                          // "ø"
convertLatex("Caf\\'e")                      // "Café"
```

120+ LaTeX口音和命令映射. 封面 `\"`, (中文(简体) ), `\'`, (中文(简体) ), `\^`, (中文(简体) ), `\~`, (中文(简体) ), `\``,` \\c`,` \\v`,` \=:`,` \\ H`,` \\u`,` \\d`,` \\b`,` ưμ㼯a`, and special commands (`旋转`,` {\\fn黑体\\fs22\\bord1\\shad0\\3ahbe\\4ah00\\fscx67\\fscy66\\2chffffff\\3ch808080}你还好吧`,` {\\FN黑体\\FS22\\BORD1\\SHAD0\\3AHBE\\4AH00\\FSCX67\\FSCY66\\2CHFFFFFF\\3CH808080}我们该走了`,` \\ ae`,` {\\FN黑体\\FS22\\BORD1\\SHAD0\\3AHBE\\4AH00\\FSCX67\\FSCY66\\2CHFFFFFF\\3CH808080}AE 说`,` \\a`,` \\. AA 对`,` \\ l`,` {\\FN黑体\\FS22\\BORD1\\SHAD0\\3AHBE\\4AH00\\FSCX67\\FSCY66\\2CHFFFFFF\\3CH808080}你觉得呢`,` \\`,` (原始内容存档于2018-10-21) (中文(简体) ).

## API 密码

### `parseBibtex(str) → CslItem[]`

将 BibTeX 字符串分析为 SSL- JSON 项 .

**支持的条目类型**数字 : `@article`, (中文(简体) ), `@book`, (中文(简体) ), `@inproceedings`, (中文(简体) ), `@incollection`, (中文(简体) ), `@inbook`, (中文(简体) ), `@phdthesis`, (中文(简体) ), `@mastersthesis`, (中文(简体) ), `@misc`, (中文(简体) ), `@techreport`, (中文(简体) ), `@unpublished`, (中文(简体) ), `@proceedings`, (中文(简体) ), `@manual`, (中文(简体) ), `@conference`, (中文(简体) ), `@booklet`, (中文(简体) ), `@online`

**处理**数字 :

-   LaTeX口音和命令转换(120+映射)
-   `@string` 缩略语扩展和 `#` 协和
-   被压缩和引用的字符串值、 嵌入式套接字
-   月份缩写`jan`– 说吧 –`dec`(中文(简体) )
-   用粒子解析名称( N)`von`, (中文(简体) ), `de`, (中文(简体) ), `de la`)并后缀(`Jr.`, (中文(简体) ), `III`(中文(简体) )
-   公司/机构作者: `{{World Health Organization}}`

### `exportBibtex(items) → string`

将 CSL-JSON 物品序列化为 BibTeX 。 生产有 en-dash 页面范围的清洁输出( E)`--`)和适当名称格式.

### `convertLatex(str) → string`

将 LaTeX 口音序列和特殊命令转换为 Unicode 字符 。 在全剖析器外处理单个 BibTeX 字段值时有用 .

## 常见问题

### @citestyle/bibtex 是什么？

BibTeX QQ CSL- JSON 解析器和序列器

### 如何安装 @citestyle/bibtex？

在项目目录运行 npm install @citestyle/bibtex，或使用 pnpm add / yarn add / bun add。

### @citestyle/bibtex 支持 TypeScript 吗？

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

### @citestyle/bibtex 支持 ESM 还是 CommonJS？

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

### @citestyle/bibtex 需要什么版本的 Node\.js？

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

### @citestyle/bibtex 可以商用吗？

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

### @citestyle/bibtex 的下载量有多少？

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

### @citestyle/bibtex 还在维护吗？

最新版本 1\.1\.0 发布于 2026/05/30（5 个月前）；至今共发布 4 个版本，其中过去 12 个月发布了 4 个；首次发布于 2026/03/13。发布频率只是参考信号：功能稳定的工具可能很少需要更新，建议结合源码仓库的 issue 和提交记录判断。

