import { transformerNotationDiff } from '@shikijs/transformers'; import { CSSProperties } from 'react'; import type { ThemedToken, codeToHtml } from 'shiki'; import { themeMap } from './themeMap'; export declare const FALLBACK_LANG = "txt"; export type ThemeProps = (typeof themeMap)[number]; declare const MD5_LENGTH_THRESHOLD = 10000; type ColorReplacements = { [themeName: string]: { [color: string]: string; }; }; declare const loadShiki: () => Promise; declare const shikiPromise: Promise; declare const escapeHtml: (str: string) => string; export type StreamingHighlightResult = { colorReplacements?: Record; lines: ThemedToken[][]; preStyle?: CSSProperties; }; export type UseStaticHighlightResponse = string; export type UseStreamHighlightResponse = StreamingHighlightResult | undefined; export type HighlightConfig = { colorReplacements: ColorReplacements; matchedLanguage: string; shikiTheme: string; transformers?: ReturnType[]; }; /** * 共享的高亮配置 hook * 处理主题、语言匹配、颜色替换等通用逻辑 */ export declare const useHighlightConfig: (lang: string, enableTransformer?: boolean, theme?: ThemeProps) => HighlightConfig; /** * 静态高亮 hook * 将代码转换为高亮 HTML 字符串 */ export declare const useStaticHighlight: (text: string, lang: string, enableTransformer?: boolean, theme?: ThemeProps) => UseStaticHighlightResponse; /** * 流式高亮 hook * 用于实时流式渲染代码高亮 */ export declare const useStreamHighlight: (text: string, lang: string, enableTransformer?: boolean, theme?: ThemeProps) => UseStreamHighlightResponse; export { languageMap } from './languageMap'; export { themeMap } from './themeMap'; export { escapeHtml, loadShiki, MD5_LENGTH_THRESHOLD, shikiPromise };