'use client' import { escapeHtml } from '@admin/utils/editor/escape-html' import katex from 'katex' export function renderLatex(expression: string, displayMode: boolean) { if (!expression.trim()) return '' try { return katex.renderToString(expression, { displayMode, output: 'htmlAndMathml', strict: 'ignore', throwOnError: false, trust: false }) } catch { return `${escapeHtml(expression)}` } }