fumadocs-core
Version:
The React.js library for building a documentation website
33 lines (31 loc) • 1.65 kB
TypeScript
import { ReactNode } from "react";
import { Components, Options } from "hast-util-to-jsx-runtime";
import { BundledHighlighterOptions, BundledLanguage, CodeOptionsMeta, CodeOptionsThemes, CodeToHastOptionsCommon, Highlighter } from "shiki";
import { Root } from "hast";
import { BundledTheme } from "shiki/themes";
//#region src/highlight/shiki.d.ts
type HighlightOptionsCommon = CodeToHastOptionsCommon<BundledLanguage> & CodeOptionsMeta & {
/**
* The Regex Engine for Shiki
*
* @defaultValue 'js'
*/
engine?: 'js' | 'oniguruma';
components?: Partial<Components>;
fallbackLanguage?: BundledLanguage;
};
type HighlightOptionsThemes = CodeOptionsThemes<BundledTheme>;
type HighlightOptions = HighlightOptionsCommon & (HighlightOptionsThemes | Record<never, never>);
declare function highlightHast(code: string, options: HighlightOptions): Promise<Root>;
declare function hastToJsx(hast: Root, options?: Partial<Options>): JSX.Element;
/**
* Get Shiki highlighter instance of Fumadocs (mostly for internal use, you should use Shiki directly over this).
*
* @param engineType - Shiki Regex engine to use.
* @param options - Shiki options.
*/
declare function getHighlighter(engineType: 'js' | 'oniguruma', options: Omit<BundledHighlighterOptions<BundledLanguage, BundledTheme>, 'engine'>): Promise<Highlighter>;
declare function highlight(code: string, options: HighlightOptions): Promise<ReactNode>;
//#endregion
export { hastToJsx as a, getHighlighter as i, HighlightOptionsCommon as n, highlight as o, HighlightOptionsThemes as r, highlightHast as s, HighlightOptions as t };
//# sourceMappingURL=shiki-CIBQys54.d.ts.map