-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
37 lines (34 loc) · 1.24 KB
/
index.html
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
30
31
32
33
34
35
36
37
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
</head>
<body>
<div id="mdTohtmlContainer"></div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/showdown/2.1.0/showdown.min.js"></script>
<script type="text/javascript">
const mdTohtmlContainer = document.getElementById("mdTohtmlContainer");
let htmlText = undefined;
var converter = new showdown.Converter({ tables: true });
converter.setFlavor("github");
const queryString = window.location.search;
const urlParams = new URLSearchParams(queryString);
let parameter = "fileURL";
let fileURL = undefined;
if (queryString.includes("&")) {
fileURL = queryString.substring(queryString.search(parameter) + parameter.length + 1);
} else {
fileURL = urlParams.get(parameter);
}
fetch(fileURL)
.then((result) => result.text())
.then((data) => {
htmlText = converter.makeHtml(data);
console.log(htmlText);
mdTohtmlContainer.innerHTML = htmlText;
});
</script>
</body>
</html>