diff options
Diffstat (limited to 'markdown.js')
-rw-r--r-- | markdown.js | 25 |
1 files changed, 0 insertions, 25 deletions
diff --git a/markdown.js b/markdown.js deleted file mode 100644 index 4b9521f..0000000 --- a/markdown.js +++ /dev/null @@ -1,25 +0,0 @@ -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 => { - if (!link.getAttribute('href').startsWith('http') && !link.getAttribute('href').startsWith('https')) { - return; - } - link.setAttribute('target', '_blank'); - }); -}
\ No newline at end of file |