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
fix(math): type the equations passed to KaTeX auto-render as HTMLElement
Elian Doran1fd7ba846e69
diff --git a/apps/client/src/types-lib.d.ts b/apps/client/src/types-lib.d.tsindex 6b34aef9ac..2059053572 100644--- a/apps/client/src/types-lib.d.ts+++ b/apps/client/src/types-lib.d.ts@@ -30,13 +30,6 @@ declare module "draggabilly" {}}-declare module "katex/contrib/auto-render" {- var renderMathInElement: (element: HTMLElement, options: {- trust: boolean;- }) => void;- export default renderMathInElement;-}-declare global {/** Geometry of the title bar area left free by the native window controls, and changes to it. */interface WindowControlsOverlay extends EventTarget {diff --git a/apps/client/src/widgets/type_widgets/text/ReadOnlyText.tsx b/apps/client/src/widgets/type_widgets/text/ReadOnlyText.tsxindex 7b785a0607..a95e16e92d 100644--- a/apps/client/src/widgets/type_widgets/text/ReadOnlyText.tsx+++ b/apps/client/src/widgets/type_widgets/text/ReadOnlyText.tsx@@ -165,7 +165,7 @@ function applyIncludedNotes(container: HTMLDivElement) {}function applyMath(container: HTMLDivElement) {- const equations = container.querySelectorAll("span.math-tex");+ const equations = container.querySelectorAll<HTMLElement>("span.math-tex");for (const equation of equations) {// throwOnError: false renders invalid formulas as an inline red error (with the// parse message as a tooltip) instead of throwing and logging to the console.diff --git a/packages/share-theme/src/types.d.ts b/packages/share-theme/src/types.d.tsindex 3fa19bd499..006c1f7b02 100644--- a/packages/share-theme/src/types.d.ts+++ b/packages/share-theme/src/types.d.ts@@ -1,5 +1 @@-declare module "katex/contrib/auto-render" {- export default function renderMathInElement(elem: HTMLElement, options?: {})-}-declare module "katex/contrib/mhchem" {}