Skip to content

Build your personal knowledge base with Trilium Notes

fix(sidebar): duplicate equations rendering

Elian Doran67a48bbec7f7
diff --git a/apps/client/src/widgets/react/hooks.tsx b/apps/client/src/widgets/react/hooks.tsx
index 3c60aed206..945bad29e5 100644
--- a/apps/client/src/widgets/react/hooks.tsx
+++ b/apps/client/src/widgets/react/hooks.tsx
@@ -1450,6 +1450,9 @@ export function useMathRendering(containerRef: RefObject<HTMLElement>, deps: unk
const mathElements = containerRef.current.querySelectorAll(".math-tex");
for (const mathEl of mathElements) {
+ // Skip if already rendered by KaTeX
+ if (mathEl.querySelector(".katex")) continue;
+
try {
math.render(mathEl.textContent || "", mathEl as HTMLElement);
} catch (e) {