/** * Footnotes (`[^id]` markers, `[^id]: text` definitions): the definitions * leave the flow, the markers are numbered in citation order, and each note * is set as a paragraph in the footnote style — at the foot of the column * that cites it (`footnotes.placement: 'column'`, placed by `build.ts`) or * after the chapter's last block (`'chapterEnd'`, see * {@link appendChapterEndNotes}). */ import type { ContentBlock } from '../parse/index.js'; import type { DigitSystem, FootnoteNumberFormat, FootnoteNumbering as FootnoteNumberingMode, ResolvedParagraphStyleConfig } from '../types.js'; import type { ResolvedConfig, VDTLine } from '../vdt.js'; /** Id of the paragraph style the notes are set in (not a user style). */ export declare const FOOTNOTE_STYLE_ID = "__postext-footnote"; /** The definitions of a document and the blocks left once they are out of * the flow. The first definition of an id wins. */ export declare function splitFootnoteDefinitions(blocks: readonly ContentBlock[]): { blocks: ContentBlock[]; defs: Map; }; /** Whether the document cites any footnote. */ export declare function citesFootnotes(blocks: readonly ContentBlock[]): boolean; export interface FootnoteNumbering { /** Note id → printed number. */ numbers: Map; /** Note id → its count (what `numbers` writes). */ counts: Map; /** Chapters of the document in order: the ids first cited in each, in * citation order, and the index of the block that closes it (the last * block before the next chapter's heading, or the last block). */ chapters: { ids: string[]; lastBlock: number; }[]; } /** The reference symbols of `numberFormat: 'symbols'` (#538), in the * order the notes of a page take them. */ export declare const DEFAULT_FOOTNOTE_SYMBOLS: readonly string[]; /** What a note's count is written in: a numeral style, or reference * symbols (`numberFormat: 'symbols'`): the default sequence, or the one * given. */ export type FootnoteFormat = FootnoteNumberFormat | { symbols: readonly string[]; }; /** The `n`th reference symbol of `symbols`: the sequence, then each symbol * doubled (`**`, `††`…), tripled… */ export declare function footnoteSymbol(n: number, symbols?: readonly string[]): string; /** The format the notes of a document are written in: a decimal number * in the document's digits (`numerals`), the named numeral style, or the * symbol sequence. */ export declare function footnoteFormatOf(f: { numberFormat: FootnoteNumberFormat; symbols?: readonly string[]; }, digits?: DigitSystem): FootnoteFormat; /** A note's count as printed in `format`, inside `template` * (`footnotes.markerTemplate`, `{n}` standing for the number). Formats * with no symbol for a count (`circled-decimal` past 50 does write * decimal) fall back to it. */ export declare function formatFootnoteNumber(n: number, format?: FootnoteFormat, template?: string): string; /** Where a note's own number stands: `footnotes.noteNumberPosition`, else * as the marker in the text — on the line at the note's size for a side * marker, and for a right one in vertical text (a superscript in * horizontal text, as the marker is there). */ export declare function noteNumberPositionOf(f: { markerPosition: 'superscript' | 'inline' | 'side' | 'right'; noteNumberPosition?: 'superscript' | 'inline'; }, vertical?: boolean): 'superscript' | 'inline'; /** Number the notes in order of first citation, starting again at each * chapter (`numbering: 'chapter'`) or running on through the document. * `startAt` is the last number an earlier document of the book used * (`'document'` numbering). `'page'` and `'column'` start from the * chapter's count: the layout numbers them again where they land (see * {@link numberFootnotesByPlacement}). */ export declare function numberFootnotes(blocks: readonly ContentBlock[], numbering: FootnoteNumberingMode, startAt?: number, format?: FootnoteFormat, template?: string): FootnoteNumbering; /** * `'page'` / `'column'` / `'spread'` numbering: the notes counted again * from 1 on every page (in every column, on every spread), in the order the * layout set them — the columns of a page in reading order, the notes of a * column top to bottom. `areas` are each page's footnote areas * (`VDTPage.footnoteAreas`). A spread is the even book page and the odd * one after it (`index + pageIndexOffset + 1` is a page's number); its * notes stand on both pages (sidenotes that overflow, JLReq §4.2.6), so * they are counted in citation order (`order`: a note's rank, by its * first marker). Notes the layout set nowhere keep no number (the caller * keeps theirs). */ export declare function numberFootnotesByPlacement(pages: readonly { index?: number; footnoteAreas?: readonly { columnIndex: number; noteIds: readonly string[]; }[]; }[], numbering: 'page' | 'column' | 'spread', format?: FootnoteFormat, template?: string, pageIndexOffset?: number, order?: ReadonlyMap): { numbers: Map; counts: Map; }; /** Whether two numberings print the same number for every note. */ export declare function sameFootnoteNumbers(a: ReadonlyMap, b: ReadonlyMap): boolean; /** Numbers a whole markdown body's notes end on — the `startAt` of the * next document under `'document'` numbering. */ export declare function lastFootnoteNumber(numbering: FootnoteNumbering): number; /** The paragraph style the notes are set in, from `footnotes`: the body * face at the note size and leading, no first-line indent. */ export declare function footnoteParagraphStyle(resolved: ResolvedConfig): ResolvedParagraphStyleConfig; /** The resolved config with the footnote style among its paragraph styles * (for the `chapterEnd` containers). */ export declare function withFootnoteStyle(resolved: ResolvedConfig): ResolvedConfig; /** The paragraph a note is set as: its number (a superscript, or at the * note's size with `markerPosition: 'inline'`) and its text. The number * maps back to the definition's start. `gap`: `footnotes.numberGap`. */ export declare function noteContentBlock(def: ContentBlock | undefined, id: string, number: string, markerPosition?: 'superscript' | 'inline', gap?: 'en' | 'em'): ContentBlock; /** `'chapterEnd'`: the notes of each chapter, in citation order, as a * `:::paragraphs` container in the footnote style after the chapter's last * block. Returns the blocks unchanged when nothing is cited. */ export declare function appendChapterEndNotes(blocks: readonly ContentBlock[], numbering: FootnoteNumbering, defs: ReadonlyMap, markerPosition?: 'superscript' | 'inline', gap?: 'en' | 'em'): ContentBlock[]; /** The notes the lines cite, in order (each id once). */ export declare function footnoteIdsOfLines(lines: readonly VDTLine[]): string[]; //# sourceMappingURL=footnotes.d.ts.map