export type ParagraphBookmark = { name: string; numericId: number; }; /** * Collect every bookmark name attached to a paragraph, in discovery order. * * Supports both attachment styles: * 1) sibling: ` ` * 2) inside: ` ... ` * * NOTE: this is a *reporting* helper — it answers "what names sit around/inside * this paragraph", by adjacency. It deliberately does NOT pair start/end by * `w:id`, so it can include a neighbouring point bookmark or one end of a * multi-paragraph range. Do not use it to resolve a caller-supplied anchor; * `findParagraphByBookmarkId` does the id-paired, exactly-one-paragraph check. */ export declare function getParagraphBookmarkNames(p: Element): string[]; /** * The paragraph's canonical safe-docx id (`_bk_*`), or null when it has none. * * This intentionally stays `_bk_`-only: it is the id we *report* for a paragraph. * To *resolve* an anchor the caller supplied, use `findParagraphByBookmarkId`, * which accepts any bookmark name on the paragraph. */ export declare function getParagraphBookmarkId(p: Element): string | null; /** * Remove Safe-DOCX paragraph anchors and edit-harness ranges, except for any * bookmark ids the caller knows came from the source document. * * @conformance ECMA-376 edition 5, Part 1 § 17.13.6.1 * @conformance ECMA-376 edition 5, Part 1 § 17.13.6.2 * @see #609 */ export declare function cleanupInternalBookmarks(doc: Document, opts?: { preserveBookmarkIds?: ReadonlySet; }): number; export declare function insertParagraphBookmarks(doc: Document, _attachmentId: string): { indexedParagraphs: number; }; export declare function insertSingleParagraphBookmark(doc: Document, p: Element): string; /** * Resolve a caller-supplied anchor to its paragraph. * * Two strictly separated paths: * * 1. **Canonical `_bk_*`** — unchanged from before foreign anchors existed: * the first paragraph whose reported id equals `bookmarkId`. A `_bk_*` anchor * NEVER falls through to the foreign path, so widening cannot move an * existing lookup (a paragraph can carry several `_bk_*` names; only the * reported one may resolve it). * * 2. **Foreign name** (a host application's own stable paragraph bookmark, or a * Word `_Toc*`/`_Ref*`) — accepted ONLY when the `w:id`-paired bookmark range * covers exactly one paragraph. This rejects a zero-length point bookmark * adjacent to a paragraph (covers none) and a heading/TOC bookmark spanning * several (covers many). Both would otherwise resolve to a paragraph the * bookmark does not actually mark — i.e. edit the wrong clause. * * Anything ambiguous returns null so the caller can fall back rather than guess. * Matching is exact on the bookmark name. * * @conformance ECMA-376 edition 5, Part 1 § 17.13.6.2 */ export declare function findParagraphByBookmarkId(doc: Document, bookmarkId: string): Element | null; //# sourceMappingURL=bookmarks.d.ts.map