-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
38 lines (36 loc) · 1.27 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Godown Preview</title>
<link rel="stylesheet" href="/static/github-markdown.css">
<link rel="stylesheet" href="/static/github.min.css">
<style>
#container{width:980px;margin:0 auto;padding:45px;border:1px solid #ddd;}
</style>
<script src="/static/highlight.min.js"></script>
<script>
window.onload = function() {
var ws = new WebSocket('ws://{{.Host}}:{{.Port}}/connect?id={{.FileID}}');
var container = document.getElementById('container');
ws.onmessage = function(e) {
var html = JSON.parse(e.data).render;
container.innerHTML = html;
var checkboxes = Array.prototype.slice.call(container.querySelectorAll('input[type=checkbox]'));
checkboxes.forEach(function(cb) {
if (cb.parentNode && cb.parentNode.nodeName === 'LI') {
cb.parentNode.classList.add('task-list-item');
}
});
Array.prototype.slice.call(container.querySelectorAll('pre code'))
.forEach(function(block) {
hljs.highlightBlock(block);
});
};
}
</script>
</head>
<body>
<div id="container" class="markdown-body"></div>
</body>
</html>