@lobehub/ui
Version:
Lobe UI is an open-source UI component library for building AIGC web apps
49 lines (48 loc) • 1.65 kB
TypeScript
/**
* Cache for storing processed content to avoid redundant processing
*/
export declare const contentCache: Map<string, string>;
/**
* Adds content to the cache with size limitation
* Removes oldest entry if cache size limit is reached
*
* @param key The cache key
* @param value The processed content to store
*/
export declare const addToCache: (key: string, value: string) => void;
/**
* Fixes markdown bold syntax by adding space after closing bold markers
* when followed by non-space characters after symbols
*
* @param text The markdown text to process
* @returns The text with fixed bold syntax
*/
export declare function fixMarkdownBold(text: string): string;
/**
* Transforms citation references in the format [n] to markdown links
*
* @param rawContent The markdown content with citation references
* @param length The number of citations
* @returns The content with citations transformed to markdown links
*/
export declare const transformCitations: (rawContent: string, length?: number) => string;
/**
* Preprocessing options for markdown content
*/
interface PreprocessOptions {
citationsLength?: number;
enableCustomFootnotes?: boolean;
enableLatex?: boolean;
}
/**
* Preprocesses markdown content by applying various transformations:
* - LaTeX preprocessing
* - Citation transformations
* - Bold syntax fixing
*
* @param str The raw markdown content
* @param options Preprocessing options
* @returns The processed markdown content
*/
export declare const preprocessContent: (str: string, { enableCustomFootnotes, enableLatex, citationsLength }?: PreprocessOptions) => string;
export {};