/** * @file GFM footnotes: which definitions a document actually cites, in * which order, and what to call them. * * Definitions stay where the author wrote them (the AST is the * document, not the rendering), so both emitters need the same answer to * the same three questions before they emit anything: which definitions * are cited, what number each one gets, and which identifiers the * reference and its back-references carry. That answer lives here once — * two emitters minting ids from two implementations is exactly how a * back-reference ends up pointing at nothing. */ export type MdNode = import('./ast.js').MdNode; export type Footnotes = { defs: MdNode[]; numbers: Map; counts: Map; refs: WeakMap; }; /** * @typedef {import('./ast.js').MdNode} MdNode */ /** * @typedef {{ defs: MdNode[], * numbers: Map, * counts: Map, * refs: WeakMap }} Footnotes */ /** * The default identifier prefix for footnotes — GitHub's own. * * Unlike a heading id (MD-FORMAT.md §4.5), which defaults to no prefix * because CommonMark asserts a bare heading and the primary consumer is * a document the host wrote, a footnote id is emitted by the DEFAULT * rendering of a feature whose whole point is a link between two places * on one page. No spec example asserts a bare `fn-1`, so the safe * default costs nothing and a host page keeps its own `#fn-1` for * itself. `slugPrefix`, when given, replaces it. */ export declare const FOOTNOTE_PREFIX = "user-content-"; /** The back-reference glyph GitHub uses. */ export declare const BACKREF_MARK = "\u21A9"; /** * Collect a document's cited footnotes. * * Returns `null` when the AST holds no `footnoteDefinition` at all — the * overwhelmingly common case, and the one that must cost nothing: the * emitters compare that `null` to decide whether anything about footnote * rendering can differ between two emissions. * * The result is memoized on the AST array, so re-rendering one document * reuses it (and with it the vnode emitter's per-node memo); a * transformed document is a different array and correctly gets fresh * numbering. * * @param {MdNode[]} ast * @returns {Footnotes|null} */ export declare function collectFootnotes(ast: MdNode[]): Footnotes | null; /** * The `id` of a rendered footnote (the `
  • ` in the section). * @param {string} prefix @param {number} number * @returns {string} */ export declare function footnoteId(prefix: string, number: number): string; /** * The `id` of one citation. A footnote cited more than once needs one * landing place per citation, or every back-reference would return the * reader to the first. * @param {string} prefix @param {number} number @param {number} occurrence * @returns {string} */ export declare function footnoteRefId(prefix: string, number: number, occurrence: number): string; /** * The accessible name of a back-reference: `↩` alone names nothing, and * a footnote with several of them needs them told apart. * @param {number} number @param {number} occurrence * @returns {string} */ export declare function backrefLabel(number: number, occurrence: number): string;