From 0684145b446c3d221a06da6d41f59c2874886fa5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yingyi=20/=20=E9=A2=96=E9=80=B8?= <49649786+Zuoqiu-Yingyi@users.noreply.github.com> Date: Fri, 11 Aug 2023 19:47:05 +0800 Subject: [PATCH] :art: set `katex.options.trust` to `true` (#8951) --- app/src/protyle/render/mathRender.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/src/protyle/render/mathRender.ts b/app/src/protyle/render/mathRender.ts index 4368ff0ec..8c4a4bcf9 100644 --- a/app/src/protyle/render/mathRender.ts +++ b/app/src/protyle/render/mathRender.ts @@ -8,7 +8,8 @@ declare const katex: { renderToString(math: string, option: { displayMode: boolean; output: string; - macros: IObject + macros: IObject; + trust: boolean; }): string; }; @@ -45,7 +46,8 @@ export const mathRender = (element: Element, cdn = Constants.PROTYLE_CDN, maxWid renderElement.innerHTML = katex.renderToString(Lute.UnEscapeHTMLStr(mathElement.getAttribute("data-content")), { displayMode: mathElement.tagName === "DIV", output: "html", - macros + macros, + trust: true, // REF: https://katex.org/docs/supported#html }); renderElement.classList.remove("ft__error"); const blockElement = hasClosestBlock(mathElement);