-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdev.html
More file actions
77 lines (74 loc) · 3.59 KB
/
dev.html
File metadata and controls
77 lines (74 loc) · 3.59 KB
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
<!DOCTYPE html>
<html>
<head>
<title>DUNote Dev</title>
<!--<script src="https://unpkg.com/femd@2.2.0/femd.min.js"></script>-->
<!--<script src="https://cdn.jsdelivr.net/gh/femarkdown/Extensible-Markdown/femd.js"></script>-->
<script src="file:\\\C:\Users\Administrator\Documents\GitHub\Extensible-Markdown\femd.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.16.8/dist/katex.min.css" integrity="sha384-GvrOXuhMATgEsSwCs4smul74iXGOixntILdUW9XmUC6+HX0sLNAK3q71HotJqlAn" crossorigin="anonymous">
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.8/dist/katex.min.js" integrity="sha384-cpW21h6RZv/phavutF+AuVYrr+dA8xD9zs6FwLpaCct6O9ctzYFfFr4dgmgccOTx" crossorigin="anonymous"></script>
<style>
.container {
display: flex;
}
.editor-column {
flex: 1;
padding: 10px;
}
.editor {
width: calc(100% - 20px);
height: 400px;
resize: vertical;
border: 1px solid #ccc;
padding: 5px;
}
#markd {
font-family: Consolas,Microsoft YaHei,'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, sans-serif;
font-weight: normal;
font-size: 16px;
line-height: 19px;
letter-spacing: 0px;
cursor: text;
outline: 0;
flex: 1;
padding: 10px;
transition: border-color 0.3s, box-shadow 0.3s;
}
#markd:hover {
border-color: #B721FF;
box-shadow: 0 0 5px #B721FF;
}
#result{
font-family: Consolas,Microsoft YaHei,'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, sans-serif;
font-weight: normal;
font-size: 16px;
line-height: 19px;
letter-spacing: 0px;
overflow-x: auto;
white-space: normal;
word-break: break-word;
}
</style>
</head>
<body>
<div class="container">
<div class="editor-column">
<textarea id="markd" class="editor" placeholder="这里写笔记..."></textarea>
</div>
<div class="editor-column">
<div id="result" class="editor"></div>
</div>
</div>
<script>
document.getElementById("markd").oninput=()=>{
var h={a:[257,225,462,224],e:[275,233,283,232],i:[299,237,464,236],o:[333,243,466,242],u:[363,250,468,249],v:[470,472,474,476,252]};
new Femd(document.getElementById("markd").value).toDOM({
make:[["~","<sub>"]],
create:[[/\${2}(.+?)\${2}/g,(i)=> katex.renderToString(i[1].replaceAll("<sup>","^").replaceAll("</sup>","^").replaceAll("<sub>","_").replaceAll("</sub>","_"), {throwOnError: false,displayMode:true})],[/\$(.+?)\$/g,(i)=> katex.renderToString(i[1].replaceAll("<sup>","^").replaceAll("</sup>","^").replaceAll("<sub>","_").replaceAll("</sub>","_"), {throwOnError: false,displayMode:false})]],
block:[[/[aeiouv][0-3]/g,k=>String.fromCharCode(h[k[0][0]][k[0][1]])],["v4",l=>String.fromCharCode(h.v[4])],
[/ *bilibili +(https\:\/\/www\.bilibili\.com\/video\/[A-z0-9=&?%_\-\.\/]+?) *</g,k=>`<iframe src="https://player.bilibili.com/player.html?bvid=${k[1].match(/video\/[A-z0-9]+?\//g)[0].slice(6,-1)}&page=1" scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true"> </iframe>`]]
}).mount("#result")
}
</script>
</body>
</html>