import type { Fn3, IObjectOf, Maybe, Primitive } from "@thi.ng/api";
import type { ILogger } from "@thi.ng/logger";
import type { ParseScope, ParseState } from "@thi.ng/parse";
import type { ParseOpts, ParseResult, TagTransforms, TransformCtx } from "./api.js";
export declare const GRAMMAR: import("@thi.ng/parse").Language | undefined;
export declare const DEFAULT_TAG_TRANSFORMS: TagTransforms;
export declare class ParseError extends Error {
    state?: ParseState<string> | undefined;
    constructor(state?: ParseState<string> | undefined);
}
/**
 * Parses given Markdown source string into a tree structure defined by given
 * {@link TagTransforms}.
 *
 * @remarks
 * The tag transforms are optional and the default implementations can be
 * overwritten on tag-by-tag basis. The default transforms yield a simple hiccup
 * tree (aka each tag will be an array in the form: `["tagname", {...},
 * ...body]`).
 *
 * See [thi.ng/hiccup](https://thi.ng/hiccup) and related packages for further
 * details.
 *
 * @param src
 * @param opts
 */
export declare const parse: (src: string, { tags, opts, linkRefs, logger, }?: Partial<{
    tags: Partial<TagTransforms>;
    opts: Partial<ParseOpts>;
    linkRefs: IObjectOf<[string, Maybe<string>?]>;
    logger: ILogger;
}>) => ParseResult;
/**
 * 1st stage of the parsing (with out result transformations). This calls the
 * `main` rule of the provided parse {@link GRAMMAR} and returns a parse
 * context, incl. the raw abstract syntax tree of the parsed document. If
 * parsing failed entirely (due to invalid input), throws a {@link ParseError}.
 *
 * @remarks
 * Note: Even if the function returns a result, parsing might only have
 * partially successful (can be checked via the [`.done`
 * flag](https://docs.thi.ng/umbrella/parse/classes/ParseContext.html#done)).
 *
 * This function is only for advanced use. Mostly you'll probably want to use
 * the main {@link parse} function instead.
 *
 * @param src
 * @param retain
 */
export declare const parseRaw: (src: string, retain?: boolean) => import("@thi.ng/parse").ParseContext<string>;
export declare const defTransformContext: (tags?: Partial<TagTransforms>, opts?: Partial<ParseOpts>, linkRefs?: IObjectOf<[string, Maybe<string>?]>, logger?: ILogger) => TransformCtx;
/**
 * Polymorphic & recursive parse scope/node transformation function. Takes a
 * single scope, context and accumulator array, then calls itself recursively
 * for any child scopes and passes relevant data to its user defined
 * {@link TagTransforms} handler and adds result to the accumulator array.
 *
 */
export declare const transformScope: Fn3<ParseScope<string>, TransformCtx, any[], void>;
/**
 * Takes an attributes object and optional metadata. If `meta` is not nullish,
 * assigns it as `__meta` key in given object. Returns object.
 *
 * @param target
 * @param meta
 */
export declare const withMeta: (target: any, meta?: any) => any;
/**
 * Takes a hiccup tree and extracts only the primitive body values (strings,
 * numbers, booleans) and returns them as array.
 *
 * @param body
 * @param acc
 */
export declare const extractBody: (body: any[], acc?: Primitive[]) => Primitive[];
//# sourceMappingURL=parse.d.ts.map