Files
documentation/node_modules/@mdx-js/mdx/lib/compile.d.ts
2024-03-22 03:47:51 +05:30

50 lines
1.7 KiB
TypeScript

/**
* Compile MDX to JS.
*
* @param {Readonly<Compatible>} vfileCompatible
* MDX document to parse.
* @param {Readonly<CompileOptions> | null | undefined} [compileOptions]
* Compile configuration (optional).
* @return {Promise<VFile>}
* Promise to compiled file.
*/
export function compile(vfileCompatible: Readonly<Compatible>, compileOptions?: Readonly<CompileOptions> | null | undefined): Promise<VFile>;
/**
* Synchronously compile MDX to JS.
*
* When possible please use the async `compile`.
*
* @param {Readonly<Compatible>} vfileCompatible
* MDX document to parse.
* @param {Readonly<CompileOptions> | null | undefined} [compileOptions]
* Compile configuration (optional).
* @return {VFile}
* Compiled file.
*/
export function compileSync(vfileCompatible: Readonly<Compatible>, compileOptions?: Readonly<CompileOptions> | null | undefined): VFile;
export type VFile = import('vfile').VFile;
export type Compatible = import('vfile').Compatible;
export type ProcessorOptions = import('./core.js').ProcessorOptions;
/**
* Core configuration.
*/
export type CoreProcessorOptions = Omit<ProcessorOptions, 'format'>;
/**
* Extra configuration.
*/
export type ExtraOptions = {
/**
* Format of `file` (default: `'detect'`).
*/
format?: 'detect' | 'md' | 'mdx' | null | undefined;
};
/**
* Configuration for `compile`.
*
* `CompileOptions` is the same as `ProcessorOptions` with the exception that
* the `format` option supports a `'detect'` value, which is the default.
* The `'detect'` format means to use `'md'` for files with an extension in
* `mdExtensions` and `'mdx'` otherwise.
*/
export type CompileOptions = CoreProcessorOptions & ExtraOptions;
//# sourceMappingURL=compile.d.ts.map