/** * DOCX Module - Text Utilities & Type Guards * * Single source of truth for type guards and text extraction helpers * used across the word module. Eliminates duplicated implementations * of `isRun`, `extractParagraphText`, `extractMathText`, etc. */ import type { Paragraph, ParagraphChild, Run, MathContent, Hyperlink } from "../types.js"; /** * Check if a paragraph child is a Run. * * A Run is the only ParagraphChild without a `type` discriminator field. * All other paragraph children (Hyperlink, InsertedRun, DeletedRun, MovedFromRun, * MovedToRun, BookmarkStart/End, CommentRangeStart/End) have an explicit `type` * string. Therefore, a child is a Run iff it has a `content` array AND no `type` * field — this is more robust than checking `content` alone (since some typed * children also have `content`-like properties). */ export declare function isRun(child: ParagraphChild): child is Run; /** Check if a paragraph child is a Hyperlink. */ export declare function isHyperlink(child: ParagraphChild): child is Hyperlink; /** * Extract plain text from a single run's content array. */ export declare function extractRunText(run: Run): string; /** * Extract concatenated plain text from a paragraph's children (runs + hyperlinks). * This recursively handles hyperlinks and tracked changes. */ export declare function extractParagraphText(para: Paragraph): string; /** * Extract text from a single paragraph child (run, hyperlink, or tracked change). */ export declare function extractChildText(child: ParagraphChild): string; /** * Extract plain text representation from math content elements. */ export declare function extractMathText(content: readonly MathContent[]): string;