Commit 3efc101 1 parent 6dbaf1e commit 3efc101 Copy full SHA for 3efc101
File tree 1 file changed +7
-6
lines changed
packages/rehype-katex/lib
1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -101,18 +101,19 @@ export default function rehypeKatex(options) {
101
101
source : 'rehype-katex'
102
102
} )
103
103
104
- // KaTeX can handle `ParseError` itself, but not others.
105
- if ( ruleId === 'parseerror' ) {
104
+ // KaTeX *should* handle `ParseError` itself, but not others.
105
+ // it doesn’t always:
106
+ // <https://github.com/remarkjs/react-markdown/issues/853>
107
+ try {
106
108
result = katex . renderToString ( value , {
107
109
...settings ,
108
110
displayMode,
109
111
strict : 'ignore' ,
110
112
throwOnError : false
111
113
} )
112
- }
113
- // Generate similar markup if this is an other error.
114
- // See: <https://github.com/KaTeX/KaTeX/blob/5dc7af0/docs/error.md>.
115
- else {
114
+ } catch {
115
+ // Generate similar markup if this is an other error.
116
+ // See: <https://github.com/KaTeX/KaTeX/blob/5dc7af0/docs/error.md>.
116
117
result = [
117
118
{
118
119
type : 'element' ,
You can’t perform that action at this time.
0 commit comments