comark-ui

中文文档
0.9.0发布于 2026/11/03MITTypeScriptES Module构建来源已验证

Every comark-ui block in one install: annotated screenshots, charts, diffs, tabs, zoom, and more, registered in the order they need with shared icons. Turn any of them off or pass its options.

原始使用文档
文档目录5 节
  1. Renderers
  2. Editor
  3. Agents
  4. Linting
  5. License

comark-ui

npm version npm downloads license docs

Every Comark block from comark-ui in one install, registered in the order they need, with one icon resolver shared by :icon, cards, details, file trees, tabs, and code actions.

pnpm add comark @comark/html comark-ui
import { createHtmlRenderer } from "@comark/html";
import comarkUi from "comark-ui/html";

const render = createHtmlRenderer(comarkUi());

comarkUi() returns { plugins, components }. Every plugin is on but include. Pass false to turn one off, which drops its components too, or an object to pass it options:

comarkUi({
  zoom: false,
  code: { actions: [{ id: "run", label: "Run" }] },
  github: { references: { repo: "owner/name" } },
  include: { root: "content" },
});

include is off because it reads files from disk; turn it on to paste files into a document. cast, table, and tests are on but read no files until you pass { root } or { read }. When you parse in a browser, pass chips: { download: false }, since a browser may not download another site's images. comark-critic has no component for its styles, so put the exported criticCss in the page. The text around the blocks (headings, paragraphs, lists, tables, code, and quotes) is styled too, from shadcn/typeset on the same tokens and scoped to the document; pass typeset: false when your site already styles Markdown. For content outside a document, such as an editor, import comark-ui/typeset.css and add the comark-typeset class. See Typeset.

It also returns tags and blocks. tags is every element a parsed document can hold besides the components; with the components' names, it's the allowlist for Comark's security plugin. blocks are the blocks the plugins replace while parsing, such as ::code-group, which a linter needs beside the components' names.

Renderers

RendererImport
@comark/htmlcomark-ui/html
@comark/vuecomark-ui/vue
@comark/reactcomark-ui/react
@comark/sveltecomark-ui/svelte

Vue, React, and Svelte leave out annotate and diff, which render only to HTML.

Editor

Editor docs cover setup, Vue bindings, file uploads, and collaborative rooms.

comark-ui/editor is a Tiptap editor for Comark Markdown, with no DOM and no framework, so a server can convert documents with it too. Install @tiptap/core, @tiptap/pm, @tiptap/starter-kit, @tiptap/extension-list, @tiptap/extension-image, and @tiptap/extension-table.

ExportWhat it does
ComarkKitThe schema: StarterKit, task lists, inline images (drawn as players for video and audio), tables, footnotes, definition lists, CriticMarkup, and Comark's components, slots, and comments, each keeping the attributes it has no field for.
fromMarkdown, toMarkdownConvert between Markdown and the editor's JSON with Comark's own parser and writer. Front matter stays beside the document.
checkMarkdown(markdown, { plugins })Whether the editor can save the document without changing what readers see, judged with the plugins the page renders with. A document it can't keep opens read-only.
UploadUploads pasted and dropped files. Each shows a placeholder with its progress until upload(file, progress) returns its URL.
createEditorCodec({ plugins }){ extensions, split, join, fromMarkdown, toMarkdown, verify } for a collaborative room, such as ViteHub Realtime's editor option. A room keeps the body as the editor's document and the frontmatter as its fields, so a text edit never overwrites the metadata.

comark-ui/editor/vue binds the editor to a Markdown string with useComarkEditor(markdown) or <ComarkEditor v-model="markdown" />. Run pnpm playground in this package to try it.

Agents

The package ships the comark-ui agent skill: a SKILL.md that says how to install the plugins, which block shows what, and how to check the result, and a reference for each package. Install it with vp dlx skills add onmax/comark-ui, link it from node_modules with vp dlx skills experimental_sync (experimental), or bundle it in your own app from comark-ui/skills/comark-ui/, which always matches the plugins it installed. vp comes with Vite+; without it, pnpm dlx takes the same arguments.

Linting

comark-linter finds comark-ui when it's installed and checks documents with its plugins and components.

License

MIT

版本与发布记录

comark-ui 共发布 11 个版本,首次发布于 2026/10/27;过去 12 个月发布了 11 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.9.0latest2026/11/03今天
0.8.22026/11/021 天前
0.8.12026/11/011 天前
0.8.02026/10/312 天前
0.7.62026/10/313 天前
0.7.52026/10/303 天前

关于 comark-ui 的常见问题

comark-ui 是什么?

一个安装中的每个标记-ui块:注释的屏幕截图,图表,差异,选项卡,缩放等,按照共享图标所需的顺序注册。关闭它们中的任何一个或传递其选项。

如何安装 comark-ui?

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

comark-ui 支持 TypeScript 吗?

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

comark-ui 支持 ESM 还是 CommonJS?

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

comark-ui 需要什么版本的 Node.js?

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

comark-ui 可以商用吗?

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

comark-ui 还在维护吗?

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