-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmd-development.html
70 lines (62 loc) · 2.18 KB
/
md-development.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<!DOCTYPE html>
<html>
<!--wmartinmimi/md.html-->
<!--MIT Licensed https://github.com/wmartinmimi/md.html/blob/main/LICENSE-->
<!--
other licenses from imported library will be displayed in browser console,
and also availble in https://github.com/wmartinmimi/md.html/licenses.json
-->
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
</head>
<body>
<p id="js_required_warning">This is a markdown viewer that requires javascript to be enabled.</p>
<div id="markdown"></div>
<section id="popup-overlay"></section>
<script>
// flags
let auto_update = true;
// info
let md_html_version = 0;
async function main() {
document.querySelector("#js_required_warning").style.display = 'none';
let response = null;
if (auto_update) {
response = await fetch('development.json');
} else {
response = await fetch('https://cdn.jsdelivr.net/gh/wmartinmimi/md.html/release.json');
}
let json = await response.json();
console.log(json);
fetch(json.licenses).then(async (response) => {
let licenses = await response.json();
for (license of licenses) {
let output = "Library: " + license.name;
output += "\nLicense type: " + license.type;
output += "\nLicense url: " + license.url;
console.info(output);
}
console.info("License json available at: " + json.licenses);
});
for (url of json.js) {
let js = document.createElement("script");
js.src = url;
js.async = false;
js.defer = false;
document.head.appendChild(js);
}
for (url of json.css) {
let link = document.createElement("link");
link.href = url;
link.rel = "stylesheet";
document.head.appendChild(link);
}
if (json.md_html > md_html_version) {
console.warn("md.html html update available! | Error 1 | Please check https://github.com/wmartinmimi/md.html for more information");
}
}
main();
</script>
</body>
</html>