import { RemarkHeadingOptions, RehypeCodeOptions } from '@netronk/gen-core/mdx-plugins';
import { CompileOptions } from '@mdx-js/mdx';
import { MDXComponents } from 'mdx/types';
import { VFile } from 'vfile';
import React from 'react';
import { TableOfContents } from '@netronk/gen-core/server';
import { Pluggable } from 'unified';

interface CompileMDXResult<TFrontmatter = Record<string, unknown>> {
    content: React.ReactElement;
    frontmatter: TFrontmatter;
    toc: TableOfContents;
    vfile: VFile;
    scope: object;
}

type ResolvePlugins = Pluggable[] | ((v: Pluggable[]) => Pluggable[]);

type MDXOptions = Omit<CompileOptions, 'remarkPlugins' | 'rehypePlugins'> & {
    remarkPlugins?: ResolvePlugins;
    rehypePlugins?: ResolvePlugins;
    remarkHeadingOptions?: RemarkHeadingOptions;
    rehypeCodeOptions?: RehypeCodeOptions | false;
    /**
     * The directory to find image sizes
     *
     * @defaultValue './public'
     */
    imageDir?: string;
};
interface CompileMDXOptions {
    source: string;
    mdxOptions?: MDXOptions;
    components?: MDXComponents;
    scope?: object;
}
declare function compileMDX<Frontmatter extends Record<string, unknown>>(options: CompileMDXOptions): Promise<CompileMDXResult<Frontmatter>>;

export { type CompileMDXOptions, type MDXOptions, compileMDX };
