-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
29 lines (27 loc) · 988 Bytes
/
script.js
File metadata and controls
29 lines (27 loc) · 988 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// Once the DOM is ready:
document.addEventListener("DOMContentLoaded", () => {
// 1. Dark Mode Toggle
const themeToggle = document.getElementById("theme-toggle");
// Restore saved theme from localStorage
const savedTheme = localStorage.getItem("theme");
if (savedTheme === "dark") {
document.body.classList.add("dark-mode");
}
themeToggle.addEventListener("click", () => {
document.body.classList.toggle("dark-mode");
localStorage.setItem(
"theme",
document.body.classList.contains("dark-mode") ? "dark" : "light"
);
});
// 2. Load Markdown content from content.md and convert to HTML using Marked.js
fetch("content.md")
.then(response => response.text())
.then(markdown => {
// Convert markdown to HTML
const html = marked.parse(markdown);
// Insert into the page
document.getElementById("resume-content").innerHTML = html;
})
.catch(error => console.error("Error loading markdown:", error));
});