-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
66 lines (63 loc) · 2.73 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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Markdown→HTML変換</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="css/uikit.min.css" />
<!--[if lt IE 9]>
<script src="//cdn.jsdelivr.net/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<link rel="shortcut icon" href="">
<meta name="mobile-web-app-capable" content="yes">
<link rel="icon" sizes="196x196" href="">
<link rel="apple-touch-icon" sizes="152x152" href="">
</head>
<body width="100%">
<header class="uk-container uk-container-expand uk-margin-small-top"><h1 class="uk-text-center">Markdown→HTML変換</h1></header>
<div class="editor uk-container uk-margin-small" width="100%">
<div style="width:50%;float:left;">
<h2>Markdownの入力フォーム</h2>
<textarea id="editor" name="markdown" rows="8" cols="40"></textarea>
</div>
<div style="width:50%;float:right;">
<h2>HTMLに変換した結果</h2>
<div class="col-md-12 ml-auto mr-auto text-left" style="border: 3px solid #ebebeb;">
<div class="preview" id="marked-preview"></div>
</div>
</div>
<div style="clear: both;">
<h2>変換結果コピペエリア</h2>
<textarea onclick="this.select();document.execCommand('copy');UIkit.notification('コピーしました');" id="result" class="uk-textarea" name="result" rows="8" cols="100" readonly></textarea>
</div>
</div>
<footer>
<p class="uk-text-center">Copyright 2018 konightch & misogihagi All Rights Reserved.</p>
</footer>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/simplemde/latest/simplemde.min.css">
<script src="https://cdn.jsdelivr.net/simplemde/latest/simplemde.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
<script src="https://code.jquery.com/jquery.js"></script>
<script src="js/uikit.min.js"></script>
<script>
(function() {
var simplemde = new SimpleMDE({ element: document.getElementById("editor"), forceSync: true, spellChecker: false });
marked.setOptions({
sanitize: true,
sanitizer: escape,
breaks : true
});
simplemde.codemirror.on("change", function(){
draw_preview()
});
})();
function draw_preview() {
var markdown = document.getElementById("editor").value;
var html = marked(markdown);
$('#marked-preview').html(html);
$('#result').val(html);
}
</script>
</body>
</html>