UNPKG

myst-to-html

Version:
57 lines 2.08 kB
import type { GenericNode, GenericParent } from 'myst-common'; export declare enum TargetKind { heading = "heading", math = "math", figure = "figure", table = "table", code = "code" } export declare enum ReferenceKind { ref = "ref", numref = "numref", eq = "eq" } type Target = { node: GenericNode; kind: TargetKind; }; type TargetCounts = { heading?: (number | null)[]; } & Record<string, number>; export type EnumeratorOptions = { disableHeadingEnumeration?: boolean; disableContainerEnumeration?: boolean; disableEquationEnumeration?: boolean; }; /** * Increment heading counts based on depth to increment * * depth is the depth to increment * counts is a list of 6 counts, corresponding to 6 heading depths * * When a certain depth is incremented, shallower depths are left the same * and deeper depths are reset to zero. Null counts anywhere are ignored. */ export declare function incrementHeadingCounts(depth: number, counts: (number | null)[]): (number | null)[]; /** * Return dot-delimited header numbering based on heading counts * * counts is a list of 6 counts, corresponding to 6 heading depths * * Leading zeros are kept, trailing zeros are removed, nulls are ignored. */ export declare function formatHeadingEnumerator(counts: (number | null)[]): string; export declare class State { targets: Record<string, Target>; targetCounts: TargetCounts; constructor(targetCounts?: TargetCounts, targets?: Record<string, Target>); addTarget(node: GenericNode): void; initializeNumberedHeadingDepths(tree: GenericParent): void; incrementCount(node: GenericNode, kind: TargetKind): string; getTarget(identifier?: string): Target | undefined; resolveReferenceContent(node: GenericNode): GenericNode['children'] | undefined; } export declare const enumerateTargets: (state: State, tree: GenericParent, opts: EnumeratorOptions) => GenericParent; export declare const resolveReferences: (state: State, tree: GenericParent) => void; export {}; //# sourceMappingURL=state.d.ts.map