import { HTMLComponents } from "../html/HTMLComponentTypes.js";
import { JSX, ReactNode, createElement } from "react";
import { ParsedMarkdown, RenderRuleHook } from "@intlayer/core/markdown";

//#region src/markdown/processor.d.ts
type HTMLTags = keyof JSX.IntrinsicElements;
/**
 * Refined MarkdownRendererOptions type.
 */
type MarkdownRendererOptions = Partial<{
  /**
   * Ultimate control over the output of all rendered JSX.
   */
  createElement: (tag: Parameters<typeof createElement>[0], props: JSX.IntrinsicAttributes, ...children: ReactNode[]) => ReactNode;
  /**
   * The library automatically generates an anchor tag for bare URLs included in the markdown
   * document, but this behavior can be disabled if desired.
   */
  disableAutoLink: boolean;
  /**
   * Disable the compiler's best-effort transcription of provided raw HTML
   * into JSX-equivalent.
   */
  disableParsingRawHTML: boolean;
  /**
   * Forces the compiler to have space between hash sign and the header text.
   */
  enforceAtxHeadings: boolean;
  /**
   * Forces the compiler to always output content with a block-level wrapper.
   */
  forceBlock: boolean;
  /**
   * Forces the compiler to always output content with an inline wrapper.
   */
  forceInline: boolean;
  /**
   * Forces the compiler to wrap results, even if there is only a single child.
   */
  forceWrapper: boolean;
  /**
   * Supply additional HTML entity: unicode replacement mappings.
   */
  namedCodesToUnicode: {
    [key: string]: string;
  };
  /**
   * Selectively control the output of particular HTML tags.
   */
  components: HTMLComponents;
  /**
   * Allows for full control over rendering of particular rules.
   */
  renderRule: RenderRuleHook;
  /**
   * Override the built-in sanitizer function for URLs.
   */
  sanitizer: (value: string, tag: HTMLTags, attribute: string) => string | null;
  /**
   * Override normalization of non-URI-safe characters for anchor linking.
   */
  slugify: (input: string) => string;
  /**
   * Declare the type of the wrapper to be used when there are multiple children.
   */
  wrapper: any | null;
  /**
   * Whether to preserve frontmatter in the markdown content.
   */
  preserveFrontmatter: boolean;
  /**
   * Whether to use the GitHub Tag Filter.
   */
  tagfilter: boolean;
}>;
/**
 * **Step 1 of 2 — parse only.**
 * Converts a raw markdown string into a `ParsedMarkdown` AST without rendering
 * any React elements. Use this when you need to:
 * - Cache the parsed result and render it several times with different options.
 * - Inspect or transform the AST before rendering.
 * - Defer the render step to a later point in the pipeline.
 *
 * @param markdown - The markdown source string.
 * @param options - Options that affect parsing (sanitizer, slugify, …).
 * @returns A `ParsedMarkdown` AST ready to be passed to `compileMarkdown`.
 *
 * @example
 * ```tsx
 * const ast = parseMarkdown('# Hello **world**');
 * const element = compileMarkdown(ast, { forceBlock: true });
 * ```
 */
declare const parseMarkdown: (markdown?: string, options?: MarkdownRendererOptions) => ParsedMarkdown;
/**
 * **Steps 1 + 2 — parse and render in one shot.**
 * Accepts a raw markdown string or a pre-parsed `ParsedMarkdown` AST and
 * returns a React element. Use `parseMarkdown` first when you need to reuse
 * the same AST with different options.
 *
 * @param input - Markdown string or pre-parsed AST.
 * @param options - Rendering options (custom components, sanitizer, slugify, …).
 * @returns A React JSX element representing the rendered markdown.
 *
 * @example
 * ```tsx
 * const element = compileMarkdown('# Hello **world**', { forceBlock: true });
 * ```
 */
declare const compileMarkdown: (input?: string | ParsedMarkdown, options?: MarkdownRendererOptions) => JSX.Element;
//#endregion
export { MarkdownRendererOptions, type ParsedMarkdown, compileMarkdown, parseMarkdown };
//# sourceMappingURL=processor.d.ts.map