🎨 set katex.options.trust to true (#8951)

This commit is contained in:
Yingyi / 颖逸 2023-08-11 19:47:05 +08:00 committed by GitHub
parent e555ea7886
commit 0684145b44
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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);