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

@bibliotype/classical

v26.10.25-rc.1

Published

古籍专有节点与标记定义(双行小注、夹注、校勘、专名号等)- bibliotype 古籍包

Readme

@bibliotype/classical

古籍专有节点与标记定义、古籍主题、classical 插件与编辑命令。 以插件形式安装到 core 实例:批量注册 13 种古籍节点并写入古籍主题令牌(卸载时自动还原)。

安装

pnpm add @bibliotype/classical @bibliotype/core

需要编辑能力时使用 ./editor 子入口(主入口不加载 ProseMirror 相关依赖):

pnpm add @bibliotype/editor

快速上手

安装插件(节点 + 主题)

import { createBibliotype } from '@bibliotype/core';
import { createClassicalPlugin } from '@bibliotype/classical';

const instance = createBibliotype();
instance.plugins.install(createClassicalPlugin());

// 安装后:古籍节点已注册、主题切换为古籍风格(可覆盖)
instance.theme.get('writing-mode');        // 'vertical-rl'(直排右起)
instance.theme.get('text-indent-body');    // '0'(古籍无首行缩进)

编辑扩展(./editor 子入口)

import { BookEditor, createBookEditorPlugins } from '@bibliotype/editor';
import { buildClassicalEditorSchema, registerClassicalEditorSpecs } from '@bibliotype/classical/editor';

/* 一步构建含古籍规格的完整 schema(标准规格 + 古籍节点/标记规格) */
const schema = buildClassicalEditorSchema();
const editor = new BookEditor({ schema, plugins: createBookEditorPlugins(schema) });

/* 或向既有注册表增量注册(返回注销函数) */
// const registry = createDefaultEditorSchemaRegistry();
// const unregister = registerClassicalEditorSpecs(registry);

编辑命令:toggleProperName · toggleBookTitle · toggleCircleEmphasis · toggleVariant · insertDoubleNote · insertHeadNote · insertCollationNote · insertCollationSymbol

选区替换为(消费选区,把选中文字搬进容器,而不是段后新建空容器): replaceWithDoubleNote · replaceWithHeadNote · replaceWithTailNote · replaceWithCollationNote · replaceWithImprint · replaceWithColophon · replaceWithBorderFrame (底层统一走 @bibliotype/editor 的 replaceSelectionWithContainer,详见 docs/20 选区替换为)。

内容模型

古籍节点(CLASSICAL_NODE_TYPES,13 种)

| 分组 | 节点 | | --- | --- | | 注疏体例 | double-note 双行小注、inline-note 夹注、head-note 眉批、tail-note 尾批 | | 校勘与字形 | collation-note 校勘记、collation-mark 校勘符号、variant-char 异体字、taboo-char 避讳字 | | 版式元素 | imprint 牌记、colophon 卷末题记、seal 印章、border-frame 版框、fish-tail 鱼尾 |

古籍标记(CLASSICAL_MARK_TYPES,7 种)

proper-name 专名号 · book-title 书名号 · circle-emphasis 圈点 · judou 句读候选(source=auto,只标记、不改字)· note-ref 注文引用锚点 · variant 异文标记 · taboo 避讳标记

古籍主题

CLASSICAL_THEME_OVERRIDES 在安装时写入(可用 createClassicalPlugin({ overrides }) 定制):

  • 正文字体改为楷体系优先(font-family-classical-body);
  • 无首行缩进(text-indent-body: '0');
  • 直排右起(writing-mode: 'vertical-rl')与数字合并策略(text-combine-upright: 'digits'、text-combine-limit: '4')。

配套布局配置使用 CLASSICAL_LAYOUT_OPTIONS(16 开、中文页码)见 @bibliotype/layout。

API 概览

| 入口 | 导出 | | --- | --- | | @bibliotype/classical | CLASSICAL_NODE_TYPES / CLASSICAL_MARK_TYPES(7 种,含 judou)、CLASSICAL_NODE_DEFINITIONS、CLASSICAL_THEME_TOKENS / CLASSICAL_THEME_OVERRIDES、createClassicalPlugin / CLASSICAL_PLUGIN_NAME | | 句读 / 专名建议(K3) | suggestJudou / judouMarkerRange / JUDOU_SYMBOLS / EXISTING_PUNCTUATION、detectProperNames / BUILTIN_PROPER_NAME_TERMS、buildAnnotationSuggestions / collectSuggestionBlocks / countSuggestions;模型端口 ProperNameDetector(宿主注入,不内置模型) | | @bibliotype/classical/editor | CLASSICAL_EDITOR_NODE_SPECS / CLASSICAL_EDITOR_MARK_SPECS、registerClassicalEditorSpecs / buildClassicalEditorSchema、编辑命令(见上);建议落地命令 applyJudouSuggestions / applyProperNameSuggestions / removeSuggestionMarks / commitJudouAsText |

相关