/** * cjk-autospace — CJK ↔ Latin 邊界自動間距 shim(Pangu.js v7.2.1 風格)。 * * 用法: * ```ts * import { createCjkAutospace } from "./cjk-autospace.js"; * * const autospace = createCjkAutospace({ * pillSelector: "code, kbd, .cjk-pill", * }); * autospace.apply(document.body); * ``` */ export interface CjkAutospaceOptions { /** 行內塊(PILL)選擇器。預設 `"code, kbd"`。 */ pillSelector?: string; /** 樣式標籤集合(shim 透明走過)。tagName 用大寫。 */ styleInlines?: readonly string[]; /** 段落級標籤集合(Pass A run 邊界)。tagName 用大寫。 */ blockTags?: readonly string[]; /** Skip-ancestor 標籤集合(subtree 整個跳過)。tagName 用大寫。 */ skipTags?: readonly string[]; /** Marker span 之 class 名。預設 `"cjk-autospace"`。 */ autospaceClass?: string; /** Skip-ancestor 額外屬性檢查(任一祖先帶此屬性則 skip)。預設 `"data-md-key"`。 */ skipAttribute?: string; /** 自訂 skip 判定(在內建判定前先檢查)。回傳 true 表示應跳過。 */ isSkipped?: (node: Node) => boolean; } export interface CjkAutospaceInstance { /** * 對指定 root(預設 `document.body`)套用 Pass A + Pass B。 * 在已注入 marker 之 DOM 上重跑為冪等(會跳過既有 `.cjk-autospace`)。 */ apply(root?: ParentNode | Document): void; } export function createCjkAutospace(options?: CjkAutospaceOptions): CjkAutospaceInstance; declare global { var createCjkAutospace: typeof createCjkAutospace; }