UNPKG

964 BTypeScriptView Raw
1import type { Node } from '../nodes/Node.js';
2import type { Document } from './Document.js';
3/**
4 * Verify that the input string is a valid anchor.
5 *
6 * Will throw on errors.
7 */
8export declare function anchorIsValid(anchor: string): true;
9export declare function anchorNames(root: Document<Node, boolean> | Node): Set<string>;
10/** Find a new anchor name with the given `prefix` and a one-indexed suffix. */
11export declare function findNewAnchor(prefix: string, exclude: Set<string>): string;
12export declare function createNodeAnchors(doc: Document<Node, boolean>, prefix: string): {
13 onAnchor: (source: unknown) => string;
14 /**
15 * With circular references, the source node is only resolved after all
16 * of its child nodes are. This is why anchors are set only after all of
17 * the nodes have been created.
18 */
19 setAnchors: () => void;
20 sourceObjects: Map<unknown, {
21 anchor: string | null;
22 node: Node | null;
23 }>;
24};