-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
66 lines (57 loc) · 1.54 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 lang="en">
<head>
<meta charset="UTF-8">
<title>Asciidoctor.js Reveal.js Backend Example</title>
<style>
.left{
width: 50%;
float:left
}
.right{
width: 50%;
float:right
}
iframe,textarea{
width:99%;
height:500px;
}
</style>
</head>
<body>
<div class="left">
<textarea id="editor" cols="30" rows="10">
:backend: revealjs
= Title
== Slide 1
Content 1
</textarea>
</div>
<div class="right">
<iframe id="output"></iframe>
</div>
<script src="http://cdnjs.cloudflare.com/ajax/libs/jquery/1.8.3/jquery.js"></script>
<script src="jade.js"></script>
<script src="asciidoctor-all.js"></script>
<script src="asciidoctor-reveal.js"></script>
<script>
var options = Opal.hash2(['safe', 'attributes'], {
safe: 'safe',
attributes: 'showtitle icons=font@ source-highlighter=highlight.js platform=opal platform-opal env=browser env-browser idprefix idseparator=- '
});
function convertSlide(){
var content = $("#editor").val();
var doc = Opal.Asciidoctor.$load(content, options);
var rendered = doc.$convert();
var iframe = document.querySelector("iframe");
iframe.contentWindow.document.open();
iframe.contentWindow.document.write(rendered);
iframe.contentWindow.document.close();
}
$("textarea").on('change keyup paste', function() {
convertSlide();
});
convertSlide();
</script>
</body>
</html>