-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
67 lines (59 loc) · 1.6 KB
/
index.html
File metadata and controls
67 lines (59 loc) · 1.6 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
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
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>html2markdown real-time</title>
</head>
<style>
.textAreaColumn{
width:100%;
}
.textAreaColumn div{
float:left;
width:50%;
padding:10px;
box-sizing: border-box;
}
.textAreaColumn div span{
display:block;
}
.textAreaColumn div textarea{
box-sizing: border-box;
width:100%;
/*border:3px solid red;*/
min-height:300px;
}
</style>
<body>
<textarea id="editor1" name="editor1"></textarea>
<div class="textAreaColumn">
<div>
<span>HTML Raw Code</span>
<textarea id="htmlSourceCode" name="htmlSourceCode"></textarea>
</div>
<div>
<span>Markdown</span>
<textarea id="markdown" name="markdown"></textarea>
</div>
</div>
<script src="jquery-3.3.1.min.js"></script>
<script src="turndown.js"></script>
<script src="ckeditor/ckeditor.js"></script>
<script>
var editor1 = CKEDITOR.replace('editor1');
var turndownService = new TurndownService({
headingStyle: 'atx',
codeBlockStyle: 'fenced'
});
editor1.on('change', function () {
console.log('change fired');
$('#htmlSourceCode').html(this.getData());
var markdown = turndownService.turndown(this.getData())
document.getElementById("markdown").value = markdown;
});
</script>
</body>
</html>