Added errorHandler Improve MathJax Performance #83

Open
Vinay-Khanagavi wants to merge 2 commits from Vinay-Khanagavi/blender-developer-docs:main into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
Showing only changes of commit c1603ce6fb - Show all commits

View File

@ -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() {