Skip to content

Commit

Permalink
fix: update katex to v0.16.9 and prevent throwing ParseError (#227)
Browse files Browse the repository at this point in the history
  • Loading branch information
fisheryv authored Jan 5, 2024
1 parent 9b38e09 commit 8873514
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/components/ui/markdown/parsers/katex.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,17 @@ const LateX: FC<LateXProps> = (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)
})
}, [])
Expand Down

1 comment on commit 8873514

@vercel
Copy link

@vercel vercel bot commented on 8873514 Jan 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

shiro – ./

springtide.vercel.app
shiro-git-main-innei.vercel.app
shiro-innei.vercel.app
innei.in

Please sign in to comment.