import type { Mark, Node } from "prosemirror-model";
export interface SerializerNodeToken {
    (state: MarkdownSerializerState, node: Node, parent: Node, index: number): void;
}
export interface SerializerMarkToken {
    open: string | ((state: MarkdownSerializerState, mark: Mark, parent: Node, index: number) => string);
    close: string | ((state: MarkdownSerializerState, mark: Mark, parent: Node, index: number) => string);
    mixable?: boolean;
    expelEnclosingWhitespace?: boolean;
    escape?: boolean;
}
interface SerializerOptions {
    tightLists?: boolean;
    escapeExtraCharacters?: RegExp;
    strict?: boolean;
    commonEscape?: RegExp;
    startOfLineEscape?: RegExp;
    escape?: boolean;
}
interface TopLevelNodeCacheEntry {
    prevClosedTypeName: string;
    output: string;
    closed: 'node' | false;
}
interface MarkMap {
    [markName: string]: SerializerMarkToken;
}
interface NodeMap {
    [nodeName: string]: SerializerNodeToken;
}
export declare class MarkdownSerializer {
    private readonly nodes;
    private readonly marks;
    private readonly dynamicModifier?;
    private _lastNode;
    private _lastOptions;
    private _lastResult;
    private _topLevelNodeCache;
    constructor(nodes: NodeMap, marks: MarkMap, dynamicModifier?: MarkdownSerializerDynamicModifier);
    serialize(content: Node, options?: Partial<SerializerOptions>): string;
    clearCache(): void;
    containsNode(nodeName: string): boolean;
    containsMark(markName: string): boolean;
}
export declare class MarkdownSerializerState {
    out: string;
    inTightList: boolean;
    noAutoBlank: boolean;
    isAutolink: boolean | undefined;
    atBlockStart: boolean;
    escapeWhitespace: boolean;
    escapeCharacters?: string[];
    private readonly nodes;
    private readonly marks;
    private readonly options;
    private delim;
    private closed;
    private readonly dynamicModifier?;
    private readonly topLevelNodeCache?;
    constructor(nodes: NodeMap, marks: MarkMap, options?: Partial<SerializerOptions>, dynamicModifier?: MarkdownSerializerDynamicModifier, topLevelNodeCache?: WeakMap<Node, TopLevelNodeCacheEntry>);
    setNoAutoBlank(): void;
    unsetNoAutoBlank(): void;
    flushClose(size?: number | null): void;
    wrapBlock(delim: string, firstDelim: string | null, node: Node, f: () => void): void;
    atBlank(): boolean;
    ensureNewLine(): void;
    write(content?: string | null): void;
    closeBlock(node?: Node): void;
    text(text: string, escape?: boolean): void;
    render(node: Node, parent: Node, index: number): void;
    renderContent(parent: Node): void;
    renderTopLevelContent(parent: Node): void;
    renderInline(parent: Node, fromBlockStart?: boolean): void;
    renderList(node: Node, delim: string, firstDelim: (index: number, firstDelimNode: Node) => string): void;
    esc(str: string, startOfLine?: boolean): string;
    escWhitespace(str: string): string;
    repeat(str: string, n: number): string;
    markString(mark: Mark, open: boolean, parent: Node, index: number): string;
    getEnclosingWhitespace(text: string): {
        leading: string | undefined;
        trailing: string | undefined;
    };
    private isMarkAhead;
    private getMark;
}
export type SerializerProcessNode = (state: MarkdownSerializerState, node: Node, parent: Node, index: number, callback?: SerializerNodeToken) => void;
export interface SerializerNodeProcessor {
    processNode?: SerializerProcessNode[];
}
export interface MarkdownSerializerDynamicModifierConfig {
    [nodeType: string]: SerializerNodeProcessor;
}
/**
 * Class MarkdownSerializerDynamicModifier
 *
 * Provides a mechanism for dynamic modification of node serialization during conversion of ProseMirror nodes
 * to a markdown-like format. It allows sequential processing of nodes by applying a series of custom handlers:
 *
 *    - `processNode`: An array of handlers that process nodes sequentially, each modifying the output.
 *
 * Example:
 * ```ts
 * const serializerModifier = new MarkdownSerializerDynamicModifier({
 *     paragraph: {
 *         processNode: [
 *             (state, node, parent, index, callback) => {
 *                 // Custom modifications can be performed here.
 *                 callback(state, node, parent, index);
 *             },
 *         ],
 *     },
 * });
 * ```
 *
 * This class extends the functionality of a MarkdownSerializer for scenarios such as:
 * - Customizing the serialization output.
 * - Logging or modifying node content during serialization.
 */
export declare class MarkdownSerializerDynamicModifier {
    private nodeProcessors;
    constructor(config: MarkdownSerializerDynamicModifierConfig);
    processNode(state: MarkdownSerializerState, node: Node, parent: Node, index: number, callback: SerializerNodeToken): void;
}
export {};
