This commit is contained in:
@@ -8,14 +8,17 @@
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
||||
<link rel="stylesheet" href="style.css">
|
||||
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
|
||||
<script>
|
||||
window.MathJax = {
|
||||
tex: {
|
||||
inlineMath: [['$', '$'], ['\\(', '\\)']]
|
||||
},
|
||||
options: {
|
||||
skipHtmlTags: ['script', 'noscript', 'style', 'textarea', 'pre']
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
@@ -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 = "<p>Caricamento in corso...</p>";
|
||||
@@ -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 = "<p style='color:red'>Errore nel caricamento dell'appunto.</p>";
|
||||
|
||||
Reference in New Issue
Block a user