diff --git a/backend/src/main/resources/get/materiale.html b/backend/src/main/resources/get/materiale.html index ef97412..e85c03b 100644 --- a/backend/src/main/resources/get/materiale.html +++ b/backend/src/main/resources/get/materiale.html @@ -8,14 +8,17 @@ - + diff --git a/backend/src/main/resources/get/materiale.js b/backend/src/main/resources/get/materiale.js index 0c2ce5f..100b665 100644 --- a/backend/src/main/resources/get/materiale.js +++ b/backend/src/main/resources/get/materiale.js @@ -2,7 +2,7 @@ async function showfile(filename, target) { const bottoni = document.querySelectorAll('.btn-appunto'); bottoni.forEach(b => b.classList.remove('active')); - if(target) target.classList.add('active'); + if (target) target.classList.add('active'); const container = document.getElementById('markdown-content'); container.innerHTML = "

Caricamento in corso...

"; @@ -10,15 +10,19 @@ async function showfile(filename, target) { try { const response = await fetch(filename); if (!response.ok) throw new Error("File non trovato"); - + const markdownRaw = await response.text(); - + container.innerHTML = marked.parse(markdownRaw); - if (window.MathJax) { - MathJax.typesetPromise([container]); + if (window.MathJax && typeof MathJax.typesetPromise === 'function') { + MathJax.typesetPromise([container]).catch(function (err) { + console.error("Errore nel rendering di MathJax: ", err); + }); + } else if (window.MathJax && window.MathJax.typeset) { + MathJax.typeset([container]); } - + } catch (error) { console.log(error) container.innerHTML = "

Errore nel caricamento dell'appunto.

";