Files
Agent-System/web/src/engine/katexRender.ts
T
weichenandCursor 63b0f72081 feat(web): load the formula engine only when math appears
The login entry no longer ships KaTeX. Chat bubbles and document text render formulas after a dynamic import, and rich-text copy does the same.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-19 10:57:49 +00:00

10 lines
291 B
TypeScript

import katex from 'katex';
/** 仅在出现公式时由 renderMarkdown 动态加载,避免进入登录入口包。 */
export function renderKatexHtml(source: string, displayMode: boolean): string {
return katex.renderToString(source, {
displayMode,
throwOnError: false,
});
}