-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
68 lines (61 loc) · 2.35 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
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
<!DOCTYPE html>
<html>
<head>
<title>Title</title>
<meta charset="utf-8">
<style>
@import url(https://fonts.googleapis.com/css?family=Yanone+Kaffeesatz);
@import url(https://fonts.googleapis.com/css?family=Droid+Serif:400,700,400italic);
@import url(https://fonts.googleapis.com/css?family=Ubuntu+Mono:400,700,400italic);
body { font-family: 'Droid Serif'; }
h1, h2, h3 {
font-family: 'Yanone Kaffeesatz';
font-weight: normal;
}
.remark-code, .remark-inline-code { font-family: 'Ubuntu Mono'; }
</style>
</head>
<body>
<textarea id="source">
</textarea>
<script src="https://remarkjs.com/downloads/remark-latest.min.js">
</script>
<script>
var slideshow = remark.create();
var getParameters = function (paramName) {
// 리턴값을 위한 변수 선언
var returnValue;
// 현재 URL 가져오기
var url = location.href;
// get 파라미터 값을 가져올 수 있는 ? 를 기점으로 slice 한 후 split 으로 나눔
var parameters = (url.slice(url.indexOf('?') + 1, url.length)).split('&');
// 나누어진 값의 비교를 통해 paramName 으로 요청된 데이터의 값만 return
for (var i = 0; i < parameters.length; i++) {
var varName = parameters[i].split('=')[0];
if (varName.toUpperCase() == paramName.toUpperCase()) {
returnValue = parameters[i].split('=')[1];
return decodeURIComponent(returnValue);
}
}
};
var mdUrl = getParameters("url");
console.log(`mark-down url : ${mdUrl}`);
fetch(mdUrl)
.then(function (response) {
console.log("fetch success");
var contentType = response.headers.get("content-type");
if(contentType && contentType.indexOf("text/plain") !== -1) {
return response.text();
} else {
console.log("Oops, we haven't got MD plain text!");
}
})
.then(function (text) {
// 템플릿 내에 MD 본문을 주입한다.
console.log(text);
// class: center, middle
document.getElementById("source").innerText = text;
});
</script>
</body>
</html>