-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
104 lines (94 loc) · 3.71 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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<html>
<head>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/showdown.min.js"
integrity="sha256-jl1+DOsSs9uABTKppOJ2GF8kXoc3XQzBtFFyS0i9Xoo=" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/jquery.min.js"
integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0=" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.js"
integrity="sha256-1qhJwAgsSPVSSjlQVTewHS49eaoAbOz651dveUANVBI=" crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.css"
integrity="sha256-tn6hZ2YGDv0w1/DaFL4MiUoXuAVclrtFZs13ch3TB9M=" crossorigin="anonymous">
<style>
@font-face {
src: url("FiraCode-Regular.ttf");
font-family: "Fire Code";
}
.major-subtitle {
font-size: 33;
}
.minor-subtitle {
font-size: 29;
}
.subtitle {
background-color: black;
width: fit-content;
padding-left: 5px;
padding-bottom: 5px;
padding-right: 5px;
padding-top: 5px;
}
.code {
font-family: "Fire Code";
color: #B7F5F7;
}
.normal-text {
font-family: 'Candara', 'SimHei';
color: white;
}
</style>
<script>
$(document).ready(() => {
const classMap = {
code: "code"
};
const bindings = Object.keys(classMap)
.map(key => ({
type: 'output',
regex: new RegExp(`<${key}(.*?)>`, 'g'),
replace: `<${key} class="${classMap[key]}" $1>`
}));
const TREMA = String.fromCharCode(168);
const DOLLARD_CHR = TREMA + "D";
const converter = new showdown.Converter({
extensions: [
{
type: 'lang', regex: `${DOLLARD_CHR}${DOLLARD_CHR}([\\S\\s]+?)${DOLLARD_CHR}${DOLLARD_CHR}`, replace: (x, y) => {
let result = katex.renderToString(y, {
throwOnError: true,
displayMode: true
});
return result;
}
},
{
type: 'lang', regex: `${DOLLARD_CHR}([\\S\\s]+?)${DOLLARD_CHR}`, replace: (x, y) => {
let result = katex.renderToString(y, {
throwOnError: true,
displayMode: false
});
return result;
}
},
...bindings],
literalMidWordUnderscores: true,
strikethrough: true
});
for (const item of $(".markdown-required")) {
const parent = $(item).parent();
parent.html(converter.makeHtml(item.innerText))
}
for (const item of $("div > p")) {
const newElem = document.createElement("div");
newElem.innerHTML = item.innerHTML;
item.replaceWith(newElem);
}
const finishSignal = document.createElement("div");
finishSignal.classList.add("finish-signal");
document.body.append(finishSignal);
});
</script>
</head>
<body>
REPLACE-HERE
</body>
</html>