Skip to content

Commit f8fc763

Browse files
committed
catch error pour Katex
1 parent efea42f commit f8fc763

File tree

3 files changed

+13
-9
lines changed

3 files changed

+13
-9
lines changed

js/processMarkdown/convertLatex.js

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,17 @@ export function convertLatexExpressions(string) {
2626
.replaceAll("&", "&")
2727
.replaceAll(" ", "\\ ");
2828
// 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+
}
3640
}
3741
}
3842
return string;

0 commit comments

Comments
 (0)