-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
51 lines (49 loc) · 1.46 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
<html>
<head>
<title>Markdown editor</title>
<link rel="stylesheet" href="https://raw.github.com/isagalaev/highlight.js/master/src/styles/github.css">
<style type="text/css">
body {
background: #fcfcfc;
font-family: Futura, "Trebuchet MS", Arial, sans-serif;
}
#editor, #preview {
background: #fff;
padding: 1%;
width: 48%;
float: left;
min-height: 80%;
}
#editor {
font-size: 1.5em;
border: none;
outline: none;
resize: none;
margin-right: 0.5%;
}
#preview {
margin-left: 0.5%;
}
</style>
</head>
<body>
<textarea id="editor" autofocus></textarea>
<div id="preview"></div>
<script src="https://raw.github.com/coreyti/showdown/master/compressed/showdown.js"></script>
<script src="http://yandex.st/highlightjs/7.3/highlight.min.js"></script>
<script type="text/javascript">
window.onload = function () {
var converter = new Showdown.converter();
var editor = document.getElementById('editor');
var preview = document.getElementById('preview');
editor.onkeyup = function () {
preview.innerHTML = converter.makeHtml(editor.value);
var aCodes = preview.getElementsByTagName('pre');
for (var i = 0; i < aCodes.length; i++) {
hljs.highlightBlock(aCodes[i]);
}
};
};
</script>
</body>
</html>