blob: a9cb5beda28546dc94e4fee824552971c0284036 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
if (extension === "md" || extension === "html") {
if (extension === "md")
document.getElementById("preview").innerHTML = marked(document.getElementById("content").innerText);
else if (extension === "html")
document.getElementById("preview").innerHTML = marked(document.getElementById("content").innerText);
document.getElementById("preview").style.display = "block";
document.getElementById("switch").style.display = "block";
document.getElementById("content").style.display = "none";
document.getElementById("switch").addEventListener("click", () => {
if (document.getElementById("preview").style.display === "block") {
document.getElementById("switch").innerText = "Show preview";
document.getElementById("preview").style.display = "none";
document.getElementById("content").style.display = "block";
} else {
document.getElementById("switch").innerText = "Show raw";
document.getElementById("preview").style.display = "block";
document.getElementById("content").style.display = "none";
}
});
}
|