-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
40 lines (36 loc) · 1.32 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
38
39
40
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>note</title>
</head>
<body>
<div id="app">
<section>
<button onclick="changeFile('git')">git</button>
<button onclick="changeFile('jnoos')">jnoos</button>
</section>
<div id="content"></div>
</div>
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/es6-promise/dist/es6-promise.js"></script>
<script src="https://cdn.jsdelivr.net/npm/unfetch/dist/unfetch.umd.js"></script>
<link rel="stylesheet" href="http://cdn.bootcss.com/highlight.js/8.0/styles/monokai_sublime.min.css">
<script>
if (!window.fetch) {
window.fetch = unfetch;
}
function changeFile(name) {
fetch(`./${name}.md`)
.then(function (res) { return res.text(); })
.then(function (text) {
document.getElementById('content').innerHTML = marked(text);
});
}
changeFile('git')
// document.getElementById('content').innerHTML = marked('# Marked in the browser\n\nRendered by **marked**.');
</script>
<script src="http://cdn.bootcss.com/highlight.js/8.0/highlight.min.js"></script>
<script>hljs.initHighlightingOnLoad();</script>
</body>
</html>