/** * Type for a per-file isolated ID generator function. * Use `createIDGenerator()` to create a new instance with its own counter. */ export type IDGenerator = (prefix?: string) => string; /** * Strategy for generating element IDs (tabs, terms, code blocks, etc.). * - `'random'` (default): uses `Math.random()` — legacy behavior, non-deterministic. * - `'deterministic'`: uses per-file counters with prefix (e.g. `'term-1'`). * - `'constant'`: always returns `'1'` — eliminates ID noise when diffing build outputs. */ export type IDGeneratorStrategy = 'random' | 'deterministic' | 'constant'; /** * Creates an isolated ID generator with its own counter per prefix. * Call once per file/document to ensure IDs start from 1 for each file. * * @example * const generateID = createIDGenerator(); * generateID('term') // → 'term-1' * generateID('term') // → 'term-2' * generateID('inline-code') // → 'inline-code-1' * generateID() // → random 8-char string * @returns An isolated {@link IDGenerator} function with its own per-prefix counters. */ export declare function createIDGenerator(): IDGenerator; /** * Factory that creates an {@link IDGenerator} based on the chosen strategy. * * @param strategy - The ID generation strategy to use. * @returns An {@link IDGenerator} function for the selected strategy. * * @example * // In CLI or any consumer: * const generateID = createIDGeneratorByStrategy('deterministic'); * // Pass to transform options — plugins will use it instead of random IDs * * @example * const generateID = createIDGeneratorByStrategy('random'); * // Returns a generator with legacy random behavior */ export declare function createIDGeneratorByStrategy(strategy?: IDGeneratorStrategy): IDGenerator;