diff --git a/src/components/ui/markdown/parsers/katex.tsx b/src/components/ui/markdown/parsers/katex.tsx index 209f31128e..beb912f15d 100644 --- a/src/components/ui/markdown/parsers/katex.tsx +++ b/src/components/ui/markdown/parsers/katex.tsx @@ -42,15 +42,17 @@ const LateX: FC = (props) => { const displayMode = mode === 'display' + const throwOnError = false // render unsupported commands as text instead of throwing a `ParseError` + useInsertionEffect(() => { loadStyleSheet( - 'https://lf9-cdn-tos.bytecdntp.com/cdn/expire-1-M/KaTeX/0.15.2/katex.min.css', + 'https://cdn.jsdelivr.net/npm/katex@0.16.9/dist/katex.min.css', ) loadScript( - 'https://lf6-cdn-tos.bytecdntp.com/cdn/expire-1-M/KaTeX/0.15.2/katex.min.js', + 'https://cdn.jsdelivr.net/npm/katex@0.16.9/dist/katex.min.js', ).then(() => { // @ts-ignore - const html = window.katex.renderToString(children, { displayMode }) + const html = window.katex.renderToString(children, { displayMode, throwOnError }) setHtml(html) }) }, [])