File tree Expand file tree Collapse file tree 3 files changed +13
-9
lines changed Expand file tree Collapse file tree 3 files changed +13
-9
lines changed Original file line number Diff line number Diff line change @@ -26,13 +26,17 @@ export function convertLatexExpressions(string) {
26
26
. replaceAll ( "&" , "&" )
27
27
. replaceAll ( " " , "\\ " ) ;
28
28
// On convertit la formule mathématique en HTML avec Katex
29
- const stringWithLatex = window . katex . renderToString (
30
- mathInExpressionLatex ,
31
- {
32
- displayMode : inlineMaths ,
33
- } ,
34
- ) ;
35
- string = string . replace ( expressionLatex , stringWithLatex ) ;
29
+ try {
30
+ const stringWithLatex = window . katex . renderToString (
31
+ mathInExpressionLatex ,
32
+ {
33
+ displayMode : inlineMaths ,
34
+ } ,
35
+ ) ;
36
+ string = string . replace ( expressionLatex , stringWithLatex ) ;
37
+ } catch ( error ) {
38
+ console . error ( "Erreur lors du rendu LaTeX avec KaTeX :" , error ) ;
39
+ }
36
40
}
37
41
}
38
42
return string ;
You can’t perform that action at this time.
0 commit comments