forked from captbaritone/jerkll
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
18 lines (18 loc) · 690 Bytes
/
index.html
File metadata and controls
18 lines (18 loc) · 690 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<script src="marked.js"></script>
<script>
(onhashchange = function(e, d) {
var p = location.hash ? location.hash.slice(1) : 'index';
d = d || {'template': 'pages/' + p + ".md"};
var r = new XMLHttpRequest(), f = /^---\n((.|\n)*)\n---/;
r.onload = function() {
d.content = marked(r.response.replace(f, function(f, j) {
for(i in s = JSON.parse(j)){ d[i] = d[i] || s[i]; };
d.template = s.template;
return '';
}).replace(/{{ (\S*) }}/g, function(m, w) { return d[w] || m; }));
d.template ? onhashchange(e, d) : document.body.innerHTML = d.content;
};
r.open("get", d.template);
r.send();
})();
</script>