// Utilizzata la libreria marked per trasformare markdown in html async function showfile(filename, target) { const bottoni = document.querySelectorAll('.btn-appunto'); bottoni.forEach(b => b.classList.remove('active')); if (target) target.classList.add('active'); const container = document.getElementById('markdown-content'); container.innerHTML = "
Caricamento in corso...
"; 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 && 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.
"; } }