mdx-prompt
Version:
Use MDX to render high quality LLM prompts
33 lines (32 loc) • 1.59 kB
TypeScript
/**
* Renders MDX content using the default render function and returns the pretty-printed HTML.
* @param {React.ReactElement} mdxSource - The MDX source element.
* @returns {string} - The pretty-printed HTML output.
*/
export declare function renderMDX(mdxSource: React.ReactElement): Promise<string>;
/**
* Options for rendering MDX prompt files.
* @typedef {Object} RenderOptions
* @property {string} filePath - Path to the MDX file.
* @property {any} [data] - Optional data to inject into MDX.
* @property {any} [components] - Optional components to customize MDX rendering.
*/
export interface RenderOptions {
filePath: string;
data?: any;
components?: any;
}
/**
* Compiles a MDX prompt file and renders it using the default render function.
* @param {RenderOptions} options - Options for rendering including filePath, and optional data/components.
* @returns {Promise<string>} - The rendered and pretty-printed HTML string.
*/
export declare function renderMDXPromptFile(options: RenderOptions): Promise<string>;
/**
* Compiles a MDX file with optional data and components injected into its scope.
* @param {string} filePath - The path to the MDX file.
* @param {any} [data] - Optional data for the MDX scope.
* @param {any} [components] - Optional components to override the defaults.
* @returns {Promise<string>} - The compiled MDX content as a string.
*/
export declare function compileMDXPromptFile(filePath: string, data?: any, components?: any): Promise<import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>>;