-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
66 lines (61 loc) · 2.01 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="pt-br">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, initial-scale=1.0, user-scalable=no">
<title>Markdown Previewer</title>
<link rel="stylesheet" href="./styles.css" />
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css"
rel="stylesheet"
integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC"
crossorigin="anonymous">
</head>
<body>
<main id="app" class="container-fluid">
<div class="row">
<h1 class="text-center">Visualizador de markdown</h1>
</div>
<div class="row">
<form class="col-sm-6 col-md-6 col-lg-12">
<textarea id="editor"
class="form-controll overflow-scroll border border-warning align-bottom"
cols="30"
placeholder="Digite seu markdown" v-model="markd"># Hello World</textarea>
</form>
</div>
<div class="row">
<div class="col-sm-6 col-md-6 col-lg-12">
<output id="preview"
class="overflow-scroll border border-info"></output>
</div>
</div>
</main>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"
integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM"
crossorigin="anonymous"></script>
<script src="https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js"></script>
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
<script type="module">
import { createApp } from 'https://unpkg.com/vue@3/dist/vue.esm-browser.js'
createApp({
data() {
return {
text: "",
markd: "# Hello World"
}
},
mounted() {
this.text = marked.parse(this.markd);
document.querySelector("#preview").innerHTML = this.text;
},
watch: {
markd() {
this.text = marked.parse(this.markd);
document.querySelector("#preview").innerHTML = this.text;
}
}
}).mount('#app');
</script>
</body>
</html>