summaryrefslogtreecommitdiff
path: root/markdown.js
diff options
context:
space:
mode:
Diffstat (limited to 'markdown.js')
-rw-r--r--markdown.js22
1 files changed, 22 insertions, 0 deletions
diff --git a/markdown.js b/markdown.js
new file mode 100644
index 0000000..3dac757
--- /dev/null
+++ b/markdown.js
@@ -0,0 +1,22 @@
+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');
+ });
+} \ No newline at end of file