diff options
author | Blaster4385 <blaster4385@tablaster.dev> | 2024-04-28 11:43:08 +0530 |
---|---|---|
committer | Blaster4385 <blaster4385@tablaster.dev> | 2024-04-29 21:04:10 +0530 |
commit | 8c968e21ffe78670871dea395c63fbeca68bc04d (patch) | |
tree | fd26b2c8c6bf8ad0d109a42ab551db1edad84f45 /markdown.js | |
parent | cf454871b15fcfccd42adfac762deabe3513d2ad (diff) |
refactor: rewrite in go
- Bye Bye JavaScript
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 |