Added errorHandler Improve MathJax Performance #83
@ -1,4 +1,3 @@
|
||||
// mathjax-config.js (New file for configuration)
|
||||
window.MathJax = {
|
||||
tex: {
|
||||
inlineMath: [["\\(", "\\)"]],
|
||||
@ -10,10 +9,9 @@ window.MathJax = {
|
||||
ignoreHtmlClass: ".*|",
|
||||
processHtmlClass: "arithmatex"
|
||||
},
|
||||
// Enable MathML output (refer to MathJax docs for customization)
|
||||
mml: {
|
||||
output: {
|
||||
font: "mathjax" // Or any preferred font
|
||||
font: "mathjax"
|
||||
}
|
||||
},
|
||||
startup: {
|
||||
@ -26,17 +24,14 @@ window.MathJax = {
|
||||
},
|
||||
errorHandler: (errors) => {
|
||||
console.error("MathJax encountered errors:", errors);
|
||||
// Additional error handling to display user-friendly messages
|
||||
}
|
||||
};
|
||||
|
||||
// In your main JavaScript file (e.g., where you include MathJax)
|
||||
document$.subscribe(debounce(() => {
|
||||
const mathElements = document.querySelectorAll('.arithmatex');
|
||||
MathJax.typesetPromise(mathElements);
|
||||
}, 250));
|
||||
|
||||
// Debounce function (You can use a library like Lodash or implement your own)
|
||||
function debounce(func, wait) {
|
||||
let timeout;
|
||||
return function() {
|
||||
|
Loading…
Reference in New Issue
Block a user