-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
38 lines (37 loc) · 1.01 KB
/
Copy pathindex.html
File metadata and controls
38 lines (37 loc) · 1.01 KB
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>
<head>
<meta charset="utf-8">
<title>Markdown Editor</title>
<script src="https://unpkg.com/vue"></script>
<script src="https://unpkg.com/marked@0.3.6"></script>
<script src="https://unpkg.com/lodash@4.16.0"></script>
<link rel="stylesheet" type="text/css" href="/style.css" />
</head>
<body>
<div id="editor">
<textarea :value="input" @input="update"></textarea>
<div v-html="compiledMarkdown"></div>
</div>
<script>
new Vue({
el: "#editor",
data: {
input: "# Привет" +
"\n## Привет" +
"\n### Привет"
},
computed: {
compiledMarkdown: function() {
return marked(this.input, { sanitize: true });
}
},
methods: {
update: _.debounce(function(e) {
this.input = e.target.value;
}, 300)
}
});
</script>
</body>
</html>