-
Notifications
You must be signed in to change notification settings - Fork 0
/
kramdown.html
50 lines (46 loc) · 1.19 KB
/
kramdown.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Ruby.wasm Quickstart</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="browser.script.iife.js"></script>
<style>
.spinner {
border: 4px solid rgba(0, 0, 0, 0.1);
width: 40px;
height: 40px;
border-radius: 50%;
border-left-color: #09f;
animation: spin 1s ease infinite;
}
@keyframes spin {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
</style>
<script type="text/ruby">
require 'js'
require 'kramdown'
div = JS.global.document.createElement("div")
text = <<MARKDOWN
# This is markdown
This is parsed markdown
## Second heading
MARKDOWN
div.innerHTML = Kramdown::Document.new(text).to_html
JS.global.document.getElementById("spinner").style.display = "none"
JS.global.document.body.appendChild(div)
</script>
</head>
<body class="main">
<h3>
Kramdown Example
</h3>
<div id="spinner" class="spinner"></div>
</body>
</html>