-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
86 lines (70 loc) · 3.05 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
<title>markdown previewer</title>
<script>
function getType(){
document.getElementById("preview").innerHTML =
marked(document.getElementById("editor").value) ;
}
function setDefault(){
let markdownkho = `
# this is a header (h1)
## this is a sub header (h2)
[link text here](https://github.com/anysbslm)
<dl>
<dt>Definiton list</dt>
<dd>is something people use sometimes.</dd>
<dt>Markdown in HTML</dt>
<dd>Does *not* work **very** well. Use HTML <em>tags</em>.</dd>
</dl>
\`This is an example of inline code\`
<pre><code>This is a code block.</code></pre>
* this is
* a list
* item
> this is a blockquote
![image text](https://www.nautiljon.com/images/jeuxvideo_persos/00/91/link_2819.webp)
**this is a bolded text**
`;
document.getElementById("editor").value = markdownkho;
document.getElementById("preview").innerHTML = marked(markdownkho);
}
</script>
</head>
<body onload="setDefault()" class="bg-success">
<h1 class="text-center my-3">Markdown Editor / Preview</h1>
<div class="container-fluid">
<div class="row">
<div class="col text-center text-white bg-success">
<h2>Editor</h2>
</div>
<div class="col text-center text-white bg-success">
<h2>Preview</h2>
</div>
</div>
<div class="row">
<div class="col-6 d-flex flex-column">
<div class="form-group flex-grow-1 d-flex flex-column">
<textarea id="editor" onkeyup=getType() class="form-control flex-grow-1"></textarea>
</div>
</div>
<div class="col">
<div id="preview">
</div>
</div>
</div>
<!-- Optional JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>
<script src="https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/marked/1.1.0/marked.js" integrity="sha512-rXiPAAB1SBl2c36kXGQZjFeG5y5GObuOoCIzSY3q13exK1ByKWQrzv9qu8iensM2vPdOucvhduZL0KyTwPzBmA==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
</body>
</html>