# @curvenote/schema 中文文档

规范地址：https://npmcn.com/package/%40curvenote/schema/

版本：0\.12\.18
npm 元数据更新时间：2022-11-23T17:54:07.011Z
中文译文更新时间：2026-11-11T05:10:33.986Z
软件包许可：MIT

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

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

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

- 包体积（解压后）：690 kB，338 个文件
- 模块格式：ESM + CJS
- TypeScript 类型：包内自带
- 运行依赖：14 个
- peer 依赖：date-fns ^2\.22\.1
- 首次发布：2021-02-14T19:31:49.793Z
- 最新版本发布：2022-11-23T17:54:06.895Z
- 近 30 天下载量：10672（2026-10-11 至 2026-11-09，npm 官方下载统计）
- 已发布版本数：75（近 12 个月 0 个）

## 中文简介

@ curvenote/ editor 的图示和下图解码器

## 安装

```sh
npm install @curvenote/schema
```

也可以使用：`pnpm add @curvenote/schema`、`yarn add @curvenote/schema`、`bun add @curvenote/schema`

## README

# @ curvenote/ schema (中文(简体) )

[![@curvenote/schema on npm](https://img.shields.io/npm/v/@curvenote/schema.svg)](https://www.npmjs.com/package/@curvenote/schema) [![MIT License](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/curvenote/editor/blob/main/LICENSE) ![CI](https://github.com/curvenote/editor/workflows/CI/badge.svg)

用于交互式科学写作的 Schema, 有翻译到 [MyST 香味淡定](https://myst-parser.readthedocs.io/en/latest/), LaTeX, 以及 HTML 。 (中文).

![@curvenote/schema in curvenote.com](https://github.com/curvenote/editor/raw/main/packages/schema/images/schema.gif)

## 概览和目标

-   提供用于编写反应性科学文件的打字方案 [@ curvenote/ 组件](https://curvenote.dev/)
    -   用途 [Web 组件](https://developer.mozilla.org/en-US/docs/Web/Web_Components) 非标准组件的 HTML 输出
    -   对所有其它语言使用标准 html, 不执行样式
-   与CommonMark 标记降低和 [MyST 数据](https://github.com/executablebooks/markdown-it-myst)
    -   穿过 `fromMarkdown` 财务报告和审定财务报表 `toMarkdown` 方法
-   提供组件用于 [维基文库](https://en.wikipedia.org/wiki/WYSIWYG) 反应文件的编辑
    -   见 [`@curvenote/editor`](https://github.com/curvenote/editor) 或者说 [曲线注释.com](https://npmcn.com/package/%40curvenote/schema/Curvenote.com) 给编辑!

## 选择

-   图书馆的内部代表是: [ProseMiror 文档](https://prosemirror.net/docs/guide/#doc) 结构(可作为JSON提供)
-   [缩放](https://github.com/markdown-it/markdown-it) 用于解析并标记下标记内容

## 司马

计划 `Nodes` 财务报告和审定财务报表 `Marks` 地点 `Nodes` 基本上是一组内容(段落、代码等) `Marks` 是对内容的内置修改(粗体、强调、链接等)。 见ProseMirror文件 [视觉解释](https://prosemirror.net/docs/guide/#doc)。 。 。 .

**概览 `Nodes`**

-   基本标记
    -   文本
    -   段 次 页 次
    -   标题
    -   块引用
    -   代码( b)
    -   图像
    -   水平规则
    -   硬断
    -   命令列表( l)
    -   符号列表
    -   列表( r)
-   演示文稿组件
    -   [点名](https://curvenote.dev/article/callout)
    -   [让开](https://curvenote.dev/article/aside)
    -   [数学](https://curvenote.dev/article/math)
    -   [等式](https://curvenote.dev/article/equation)
-   反应组件
    -   [变量](https://curvenote.dev/components/variable)
    -   [显示](https://curvenote.dev/components/display)
    -   [动态](https://curvenote.dev/components/dynamic)
    -   [范围](https://curvenote.dev/components/range)
    -   [切换](https://curvenote.dev/components/switch)

**概览 `Marks`**

-   链接
-   代码
-   计划
-   强
-   上标
-   下标
-   击穿
-   下划线
-   书目

## 简单示例

这从马克下移 -- > JSON -- > HTML。 JSON是代表 `@curvenote/editor`。 。 。 .

```javascript
import { Schema, nodes, marks, fromMarkdown, toHTML } from '@curvenote/schema';
import { JSDOM } from 'jsdom';

const schema = new Schema({ nodes, marks });

const content = '# Hello `@curvenote/schema`!';
const doc = fromMarkdown(content, schema);

console.log(doc.toJSON());
>> {
    "type": "doc",
    "content": [
      {
        "type": "heading",
        "attrs": { "level": 1 },
        "content": [
          { "type": "text", "text": "Hello " },
          {
            "type": "text",
            "marks": [ { "type": "code" } ],
            "text": "@curvenote/schema"
          },
          { "type": "text", "text": "!" }
        ]
      }
    ]
  }

// Assuming we are in node, just use `document` if in a browser!
const { document } = new JSDOM('').window;

// Now move the document back out to html
const html = toHTML(doc, schema, document);

console.log(html);
>> "<h1>Hello <code>@curvenote/schema</code>!</h1>"
```

### 路线图

-   整合其他 `@curvenote/components` 作为节点
-   改进等式, 并开始读取/ 从 MyST 语法中读取此语法
-   添加图属性( 名称、 宽度、 标题等)
-   提供引用, 可能带入 Bibtex 解析器
    -   在曲线注释/组件或文章中引入引用和参考部分
-   添加与 MyST 重叠的角色/指令( 例如参见) [可执行的可执行书/meta#70](https://github.com/executablebooks/meta/issues/70)用于指针
    -   在非基本html(MyST使用狮身人面像来进行举重,交叉反射等)的曲线注/组件中添加必要的棋子
-   提供文档构造中的其他静态器( 例如: ladx 或 简单的 html , 没有曲线注释/ 组件, 可能为 idyll)

## 另见:

-   [伊迪尔·朗](https://idyll-lang.org/) 具有不同的标记下式序列化,其基础组件与曲线注释非常相近 - 见 [曲线/ 第8条](https://github.com/curvenote/article/issues/8) 为比较.

## 常见问题

### @curvenote/schema 是什么？

@ curvenote/ editor 的图示和下图解码器

### 如何安装 @curvenote/schema？

在项目目录运行 npm install @curvenote/schema，或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖：date-fns（^2\.22\.1）。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖，Yarn 需要手动安装。

### @curvenote/schema 支持 TypeScript 吗？

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

### @curvenote/schema 支持 ESM 还是 CommonJS？

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

### @curvenote/schema 可以商用吗？

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

### @curvenote/schema 的下载量有多少？

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

### @curvenote/schema 还在维护吗？

最新版本 0\.12\.18 发布于 2022/11/24（3 年前）；至今共发布 75 个版本，其中过去 12 个月发布了 0 个；首次发布于 2021/02/15。发布频率只是参考信号：功能稳定的工具可能很少需要更新，建议结合源码仓库的 issue 和提交记录判断。

