22 lines
No EOL
583 B
JavaScript
22 lines
No EOL
583 B
JavaScript
function loadMarkdownFile(fileName) {
|
|
fetch(`/assets/md/${fileName}`)
|
|
.then(response => response.text())
|
|
.then(text => {
|
|
document.getElementById('markdown').innerHTML = convertMarkdownToHTML(text);
|
|
addBlankTargetToLinks();
|
|
})
|
|
.catch(error => {
|
|
console.error('Error loading Markdown file:', error);
|
|
});
|
|
}
|
|
|
|
function convertMarkdownToHTML(markdown) {
|
|
return marked.parse(markdown);
|
|
}
|
|
|
|
function addBlankTargetToLinks() {
|
|
const links = document.querySelectorAll('a');
|
|
links.forEach(link => {
|
|
link.setAttribute('target', '_blank');
|
|
});
|
|
} |