/**
 * @file parser.ts
 * @input Markdown string
 * @output Array of MarkdownNode AST nodes
 * @position Core parser; consumed by Markdown.tsx
 */
export type InlineNode = {
    type: 'text';
    content: string;
} | {
    type: 'bold';
    children: InlineNode[];
} | {
    type: 'italic';
    children: InlineNode[];
} | {
    type: 'strikethrough';
    children: InlineNode[];
} | {
    type: 'code';
    content: string;
} | {
    type: 'link';
    href: string;
    children: InlineNode[];
} | {
    type: 'image';
    src: string;
    alt: string;
} | {
    type: 'citation';
    sourceId: string;
} | {
    type: 'break';
};
export type BlockNode = {
    type: 'heading';
    level: 1 | 2 | 3 | 4 | 5 | 6;
    children: InlineNode[];
} | {
    type: 'paragraph';
    children: InlineNode[];
} | {
    type: 'codeblock';
    language: string;
    content: string;
} | {
    type: 'blockquote';
    children: BlockNode[];
} | {
    type: 'list';
    ordered: boolean;
    start?: number;
    /** Ordered-list marker delimiter ('.' or ')'). Undefined for bullets. */
    delimiter?: '.' | ')';
    loose?: boolean;
    items: ListItemNode[];
} | {
    type: 'table';
    headers: TableCellNode[];
    alignments: TableAlignment[];
    rows: TableCellNode[][];
} | {
    type: 'hr';
} | {
    type: 'image';
    src: string;
    alt: string;
};
export type ListItemNode = {
    checked?: boolean;
    children: BlockNode[];
};
export type TableCellNode = {
    children: InlineNode[];
};
export type TableAlignment = 'left' | 'center' | 'right' | null;
/**
 * Options for the markdown parser entry points.
 *
 * Backward-compatible: the public `parseMarkdown` / `parseInline` /
 * `parseMarkdownIncremental` functions also accept the legacy
 * `ReadonlySet<string>` shape as the second argument.
 */
export type ParseOptions = {
    /** Set of citation source ids — `[id]` / `【id】` markers in this set
     *  become citation nodes instead of plain text / links. */
    sourceIds?: ReadonlySet<string>;
    /**
     * Autolink mode. When set to `'gfm'`, the parser turns bare
     * `https?://…` / `www.…` URLs, `<URL>` / `<email>` angle-bracket
     * forms, and `user@host` emails into `link` inline nodes (per the
     * GitHub Flavored Markdown autolink-literal extension plus the
     * CommonMark §6.5 autolink form). Disabled by default.
     *
     * Two intentional deviations from the strict GFM spec for v1:
     * trailing `&entity;` is not peeled off the URL, and an invalid TLD
     * suffix is not rejected (Astryx accepts any plausible TLD shape).
     */
    autolink?: 'gfm';
};
export declare function parseInline(text: string, sourceIds?: ReadonlySet<string>): InlineNode[];
export declare function parseInline(text: string, options: ParseOptions): InlineNode[];
export declare function parseMarkdown(input: string, sourceIds?: ReadonlySet<string>): BlockNode[];
export declare function parseMarkdown(input: string, options: ParseOptions): BlockNode[];
export interface IncrementalState {
    prevInput: string;
    settledText: string;
    settledBlocks: BlockNode[];
    settledUpTo: number;
    /**
     * The `autolink` option the cached `settledBlocks` were parsed with.
     * `parseMarkdownIncremental` invalidates the cache when the caller flips
     * this option, so already-settled URLs flip between link/text along
     * with newly-arriving content.
     */
    autolink?: 'gfm';
    /**
     * Signature of the link reference definitions the cached `settledBlocks`
     * were parsed with. Definitions are document-global and typically arrive
     * (in a footer) after the references that use them, so when the set changes
     * the settled cache is invalidated to let earlier references resolve.
     */
    linkDefsKey?: string;
}
export declare function createIncrementalState(): IncrementalState;
/**
 * Strip trailing incomplete inline syntax that appears during streaming.
 * Only affects the tail of the last line — safe to apply to the full string.
 */
export declare function trimStreamingArtifacts(input: string): string;
export declare function parseMarkdownIncremental(input: string, state: IncrementalState, sourceIds?: ReadonlySet<string>): BlockNode[];
export declare function parseMarkdownIncremental(input: string, state: IncrementalState, options: ParseOptions): BlockNode[];
//# sourceMappingURL=parser.d.ts.map