import { renderMath } from "@/lib/math";
/** Server component: plain text with inline/display TeX rendered through KaTeX; everything else escaped. */
export function MathText({
text,
as: Tag = "p",
className = "",
}: {
text: string;
as?: "p" | "span" | "div" | "li";
className?: string;
}) {
const { html, hasMath } = renderMath(text);
if (!hasMath) return {text};
// biome-ignore lint/security/noDangerouslySetInnerHtml: output of renderMath (escaped text + KaTeX markup)
return ;
}