npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@maxoyed/ode-core

v0.4.1

Published

Headless 公文编辑器核心:GB/T 9704-2012 版式规范、Tiptap 公文节点与字体插槽,与前端框架无关。

Readme

@maxoyed/ode-core

Headless 的中国党政机关公文编辑器核心,默认排版即符合 GB/T 9704-2012《党政机关公文格式》,基于 Tiptap(ProseMirror)构建,与前端框架无关。纯前端、离线可用。

框架封装见 @maxoyed/ode-vue / @maxoyed/ode-react

安装

pnpm add @maxoyed/ode-core

用法

import { createOfficialDocumentEditor } from "@maxoyed/ode-core";
import "@maxoyed/ode-core/styles.css";

const editor = createOfficialDocumentEditor({
  element: document.querySelector("#page")!, // 一个 .odoc-page 容器
  pagination: true, // 可选:编辑器内联实时分页
});

editor.chain().focus().setOfficialRole("title").run();

子路径导出:

  • @maxoyed/ode-core/spec — GB/T 9704-2012 版式规范(纯数据,零依赖)
  • @maxoyed/ode-core/pagination — headless 分页引擎(纯函数)
  • @maxoyed/ode-core/validate — 合规校验(validateDocument,纯函数)
  • @maxoyed/ode-core/docx — docx 导入/导出(toDocxBlob / fromDocx
import { paginate, blocksFromDoc } from "@maxoyed/ode-core/pagination";
import { toDocxBlob, fromDocx } from "@maxoyed/ode-core/docx";

能力

  • 公文版式渲染与编辑(红头、标题、各级标题、正文、署名、版记、页码…)
  • 精确分页:headless 引擎 + 编辑器内联实时分页(行级跨页断行)+ 打印 / 导出 PDF
  • docx 往返:命名样式无损 · 表格(含合并单元格)· 图片 · 印章 · 版记线
  • 合规校验 validateDocument:按 GB/T 9704 检查要素完整性/顺序/格式
  • 字体插槽 registerFont:开源字体兜底 + 用户授权字体注入

字体与版权

本库不内置/不分发仿宋_GB2312、方正小标宋等商业字体;以 local() 优先引用本机公文字体、开源字体兜底,并提供 registerFont() 由使用方提供已授权字体。

许可

MIT · 详见仓库 official-document-editor