-
Notifications
You must be signed in to change notification settings - Fork 5
/
docsify_sample_index.html
158 lines (143 loc) · 5.6 KB
/
docsify_sample_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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="content-language" content="zh-CN">
<!-- for web app -->
<meta name="apple-mobile-web-app-title" content="notebook" />
<link rel="apple-touch-icon" href="/notebook/note.png" />
<title>Erimus</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="description" content="Description" />
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0" />
<!-- Theme: Simple (latest v0.x.x) -->
<link rel="stylesheet" href="typora-docsify/theme-simple.css" />
<link rel="stylesheet" href="typora-docsify.css">
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/prism/1.28.0/themes/prism-okaidia.min.css">
</head>
<body>
<div id="app"></div>
<script src="//unpkg.com/docsify/lib/docsify.min.js"></script>
<!-- 关系图插件 -->
<script src="//unpkg.com/mermaid/dist/mermaid.min.js"></script>
<script>
// mermaid init
let num = 0;
mermaid.initialize({ startOnLoad: false, pie: { useMaxWidth: false } });
// 配置说明 https://docsify.js.org/#/zh-cn/configuration
window.$docsify = {
name: "Erimus",
repo: "",
maxLevel: 6, //文档中标题等级
auto2top: true, //切换页面后是否自动跳转到页面顶部
homepage: "readme.md", // 入口文件
// coverpage: true, // 封面页
noEmoji: true,
topMargin: 100,
// ========== navbar
// loadNavbar: true,
// mergeNavbar: true,
// ========== sidebar
loadSidebar: 'docsify_sample_sidebar.md',
subMaxLevel: 3,
// logo: "icon.png",
// autoHeader: true,
// ========== search
search: {
noData: {
"/": "No results!"
},
paths: "auto",
placeholder: {
"/": "Search"
}
},
formatUpdated: "{YYYY}-{MM}-{DD} {HH}:{mm}",
markdown: {
smartypants: true,
breaks: true, // 不用双空格直接换行
renderer: {
code: function(code, lang) {
if (lang === "mermaid") {
return (
'<div class="mermaid">' + mermaid.render('mermaid-svg-' + num++, code) + "</div>"
);
}
return this.origin.code.apply(this, arguments);
}
},
},
plugins: [
function(hook, vm) {
hook.beforeEach(function(html) {
//适配Markdown的====高亮语法
let res = html.match(/==(.+?)==/g);
if (res) {
for (let i in res) {
html = html.replace(res[i], `<mark>` + res[i].replace(/==/g, "") + `</mark>`);
}
}
// todolist
res = html.match(/(?<=- )\s{0,4}\[(x|\s)\]/g);
console.log('res:', res)
if (res) {
for (let i in res) {
console.log('res[i]:', res[i])
html = html.replace(res[i], `<input type="checkbox" ${(res[i].indexOf("x")==-1)?"":"checked"} />`);
}
}
//将更新时间加到文档的尾部
return html + '\n<q>Last Modified: {docsify-updated}</q>';
})
}
],
toc: {
tocMaxLevel: 5,
target: 'h2, h3, h4, h5, h6'
},
};
</script>
<!-- 搜索 -->
<script src="//unpkg.com/docsify/lib/plugins/search.min.js"></script>
<!-- 翻页插件 -->
<script src="//unpkg.com/docsify-pagination/dist/docsify-pagination.min.js"></script>
<!-- 增加引用框的类型 -->
<!-- https://github.com/fzankl/docsify-plugin-flexible-alerts -->
<!-- <script src="//unpkg.com/docsify-plugin-flexible-alerts"></script> -->
<!-- 图片放大 -->
<script src="//cdn.jsdelivr.net/npm/docsify/lib/plugins/zoom-image.min.js"></script>
<!-- 复制代码 -->
<script src="//unpkg.com/docsify-copy-code"></script>
<!-- wikilink -->
<script src="//cdn.jsdelivr.net/npm/docsify-wikilink"></script>
<!-- TOC -->
<!-- <script src="//unpkg.com/docsify-plugin-toc"></script> -->
<!-- 代码高亮 -->
<script src="//cdnjs.cloudflare.com/ajax/libs/prism/1.28.0/components/prism.min.js"></script>
<!-- <script src="//cdnjs.cloudflare.com/ajax/libs/prism/1.28.0/plugins/autoloader/prism-autoloader.min.js"></script> -->
<script>
window.onload = async function() {
let codeTypes = [];
let allCodes = document.querySelectorAll('pre code')
for (let i in allCodes) {
let code = allCodes[i]
const type = code.className.replace('lang-', '')
if (type) {
// import js
if (!codeTypes.includes(type)) {
codeTypes.push(type)
try {
await import(`//cdnjs.cloudflare.com/ajax/libs/prism/1.28.0/components/prism-${type}.min.js`)
console.log('import success:', type)
} catch (error) {
console.warn('error:', error)
}
}
// apply prism
Prism.highlightElement(code)
}
}
}
</script>
</body>
</html>