Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
feat(llm): render math
Elian Doran7d0b1a7fc124
diff --git a/apps/client/src/widgets/type_widgets/llm_chat/ChatMessage.tsx b/apps/client/src/widgets/type_widgets/llm_chat/ChatMessage.tsxindex ff67d82dbb..c024076eed 100644--- a/apps/client/src/widgets/type_widgets/llm_chat/ChatMessage.tsx+++ b/apps/client/src/widgets/type_widgets/llm_chat/ChatMessage.tsx@@ -4,6 +4,7 @@ import DOMPurify from "dompurify";import { useEffect, useMemo, useRef } from "preact/hooks";import { type LlmCitation, renderToHtml } from "@triliumnext/commons";+import { renderMathInElement } from "../../../services/math.js";import link from "../../../services/link.js";import { t } from "../../../services/i18n.js";@@ -39,6 +40,11 @@ function MarkdownContent({ html, isStreaming }: { html: string; isStreaming?: bofor (const el of referenceLinks) {link.loadReferenceLinkTitle($(el), el.href);}++ const equations = containerRef.current.querySelectorAll("span.math-tex");+ for (const equation of equations) {+ renderMathInElement(equation, { trust: true });+ }}, [html]);return (