/** * footnotes — OOXML footnote bootstrapping, CRUD, and display numbering. * * Creates footnote XML parts when missing, inserts footnote reference runs, * and supports reading, updating, and deleting footnotes. */ import { DocxZip } from './zip.js'; import { type StylesModel } from './styles.js'; import { type RevisionContext } from './track-changes-emitter.js'; /** * One paragraph of a footnote body, retained at the same node-level fidelity as * a document-body paragraph: the flattened visible `text`, an inline-tagged * rendering (`tagged_text`) that preserves run-level bold/italic/underline/ * highlight/color/font (via {@link emitFormattingTags} in `full` mode — no * baseline suppression, so every deviation survives), and the paragraph's * `w:pStyle` id (e.g. `FootnoteText`). */ export type FootnoteParagraph = { text: string; tagged_text: string; style: string | null; }; export type Footnote = { id: number; displayNumber: number; /** * Flattened body text, `\n`-joined across paragraphs. Retained for * backward-compatibility with serializers and `get_footnotes`; new consumers * that need multi-paragraph structure or run formatting should read * {@link Footnote.paragraphs}. */ text: string; /** * First paragraph that references this footnote. Retained for * backward-compatibility; prefer {@link Footnote.refParagraphIds}, which * captures every referencing paragraph (a malformed DOCX can illegally reuse * one footnote id from multiple paragraphs). */ anchoredParagraphId: string | null; /** * Every distinct paragraph (by bookmark id) that carries a * `w:footnoteReference` to this footnote, in document order. Usually one * entry; empty when the note is orphaned (no reference in the body). */ refParagraphIds: string[]; /** * Structured, run-formatting-preserving body paragraphs. Present at * node-level fidelity — see {@link FootnoteParagraph}. */ paragraphs: FootnoteParagraph[]; }; export type AddFootnoteParams = { paragraphEl: Element; afterText?: string; text: string; }; export type AddFootnoteResult = { noteId: number; }; export type BootstrapFootnoteResult = { partsCreated: string[]; }; export declare function isReservedFootnote(footnoteEl: Element): boolean; export declare function bootstrapFootnoteParts(zip: DocxZip): Promise; /** * Read every user footnote body, retaining multi-paragraph structure and * run-level formatting. * * `styles` is optional: when provided (from `DocxDocument.getStylesModel()`), * the per-paragraph `tagged_text` resolves run formatting through the character- * and paragraph-style chains (so e.g. a `Strong` character style renders ``). * When omitted, formatting is read from direct `w:rPr` only — the flattened * `text` and the plural anchor map are unaffected either way, so existing * callers that pass `(zip, documentXml)` keep their exact behavior. */ export declare function getFootnotes(zip: DocxZip, documentXml: Document, styles?: StylesModel): Promise; export declare function getFootnote(zip: DocxZip, documentXml: Document, noteId: number, styles?: StylesModel): Promise; export declare function addFootnote(documentXml: Document, zip: DocxZip, params: AddFootnoteParams, ctx?: RevisionContext): Promise; export declare function updateFootnoteText(zip: DocxZip, params: { noteId: number; newText: string; }, ctx?: RevisionContext): Promise; export declare function deleteFootnote(documentXml: Document, zip: DocxZip, params: { noteId: number; }, ctx?: RevisionContext): Promise; //# sourceMappingURL=footnotes.d.ts.map