From fa0b0009a386681d8ac03309fe62bafbd716b48e Mon Sep 17 00:00:00 2001 From: Vinay khanagavi <116386393+Vinay-Khanagavi@users.noreply.github.com> Date: Mon, 14 Oct 2024 13:46:55 +0530 Subject: [PATCH 1/2] Changes to be committed: modified: docs/javascripts/mathjax.js --- docs/javascripts/mathjax.js | 37 ++++++++++++++++++++++++++++++++++--- 1 file changed, 34 insertions(+), 3 deletions(-) diff --git a/docs/javascripts/mathjax.js b/docs/javascripts/mathjax.js index a80ddbff..41c61553 100644 --- a/docs/javascripts/mathjax.js +++ b/docs/javascripts/mathjax.js @@ -1,3 +1,4 @@ +// mathjax-config.js (New file for configuration) window.MathJax = { tex: { inlineMath: [["\\(", "\\)"]], @@ -8,9 +9,39 @@ window.MathJax = { options: { ignoreHtmlClass: ".*|", processHtmlClass: "arithmatex" + }, + // Enable MathML output (refer to MathJax docs for customization) + mml: { + output: { + font: "mathjax" // Or any preferred font + } + }, + startup: { + ready() { + MathJax.startup.defaultReady(); + MathJax.Config({ + showErrorMessages: true, + }); + } + }, + errorHandler: (errors) => { + console.error("MathJax encountered errors:", errors); + // Additional error handling to display user-friendly messages } }; -document$.subscribe(() => { - MathJax.typesetPromise() -}) \ No newline at end of file +// 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() { + const context = this, args = arguments; + clearTimeout(timeout); + timeout = setTimeout(() => func.apply(context, args), wait); + }; +} \ No newline at end of file -- 2.30.2 From c1603ce6fbb9145cb104f22ccbf12abadd48f491 Mon Sep 17 00:00:00 2001 From: Vinay khanagavi <116386393+Vinay-Khanagavi@users.noreply.github.com> Date: Mon, 14 Oct 2024 16:07:51 +0530 Subject: [PATCH 2/2] Changes to be committed: modified: docs/javascripts/mathjax.js --- docs/javascripts/mathjax.js | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/docs/javascripts/mathjax.js b/docs/javascripts/mathjax.js index 41c61553..de283336 100644 --- a/docs/javascripts/mathjax.js +++ b/docs/javascripts/mathjax.js @@ -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() { -- 2.30.2