@agentshouse/mdmodel

中文文档
0.1.0-c03f6cf931ca0发布于 2026/11/07MITTypeScriptES Module近 30 天下载 2万

MD Type language, parser, validator, structured change application, Markdown syntax profile, and conformance fixtures

原始使用文档
文档目录4 节
  1. Install
  2. Usage
  3. API
  4. License

@agentshouse/mdmodel

Typed Markdown documents: MD Types declared in JSON Schema, whose values a Document writes in its Markdown body, a reader, a writer and validator of them, the deterministic application of one structured change to a Document, and one query language answered in SQL over a collection or in memory over one Document, plus a conformance fixture corpus.

It runs in the browser and in Node, makes no network call, and reads no filesystem on its own. It ships one ESM artifact that Node 24.22.1 and later loads through import or require.

Install

npm install @agentshouse/mdmodel

Usage

import { apply, parse, serialize, validate, verify } from '@agentshouse/mdmodel';

const checked = verify('task:\n  properties:\n    title: { type: string, title: Title }\n');
if (checked.verdict === 'accept') {
  const task = checked.model.types.task;
  validate({ 'one.md': '---\ntype: task\n---\n- **Title**: Ship\n' }, undefined, checked.model);
  const parsed = parse('---\ntype: task\n---\n- **Title**: Hello\n', 'one.md', task);
  if (parsed.ok) {
    const change = { kind: 'field', name: 'title', value: 'World', prior: 'Hello' } as const;
    const next = apply(parsed.document, [change], task);
    if (next.outcome === 'applied') serialize(next.document);
  }
}

API

ExportPurpose
verifyVerify one schema text into a model of MD Types
validateValidate a text Library; returns acceptance or one refusal
parse, serializeRead and write one Document
applyApply field, section, preamble, link and reference changes at once
links, target, retargetInventory and rewrite link destinations
escapePointerWrite one key as a JSON Pointer token
project, divideEmbedding projection input and its division into Spans
facts, candidateOfA Document as one change saw it, matched as one query candidate
planOf, matches, sqlCheck a query, answer it over one Document or compile it to SQL
VERSIONThe MD model version
MEMBER_FIELD, SITE_FIELD, SUBMITTED_FIELDThe frontmatter keys validation counts as declared beyond a type's
MEDIA_TYPES, servedMediaTypeThe media types House writes and the one table of file extensions

The full reference is in API.md. The conformance corpus and its verdict format and rule ids are described in fixtures/README.md.

License

MIT

版本与发布记录

@agentshouse/mdmodel 共发布 104 个版本,首次发布于 2026/09/07;过去 12 个月发布了 104 个版本。

版本发布日期距今
0.1.0-c03f6cf931ca0latest2026/11/07今天
0.1.0-c9a0eed64bb5f2026/11/07今天
0.1.0-cbe9e36156a2a2026/11/071 天前
0.1.0-c8ef006e419a02026/11/071 天前
0.1.0-c2e6f0cf254e02026/11/061 天前
0.1.0-c807a6b98e2b42026/11/061 天前

其他发布通道:alpha → 0.1.0-alpha.11,pushed → 0.1.0-c783c03d17e49。

关于 @agentshouse/mdmodel 的常见问题

@agentshouse/mdmodel 是什么?

MD Type language, parser, validator, structured change application, Markdown syntax profile, and conformance fixtures

如何安装 @agentshouse/mdmodel?

在项目目录运行 npm install @agentshouse/mdmodel,或使用 pnpm add / yarn add / bun add。

@agentshouse/mdmodel 支持 TypeScript 吗?

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

@agentshouse/mdmodel 支持 ESM 还是 CommonJS?

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

@agentshouse/mdmodel 需要什么版本的 Node.js?

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

@agentshouse/mdmodel 可以商用吗?

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

@agentshouse/mdmodel 的下载量有多少?

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

@agentshouse/mdmodel 还在维护吗?

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