docsify入门
# 官方文档
docsify官方网站 (opens new window)
# 推荐全局安装 docsify-cli 工具
npm i docsify-cli -g
docsify init ./docs #初始化项目
docsify serve docs #
#用python3的方式启动项目
cd docs && python -m http.server 3000
1
2
3
4
5
6
7
8
2
3
4
5
6
7
8
# index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</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">
<link rel="stylesheet" href="//unpkg.com/docsify/lib/themes/vue.css">
</head>
<body>
<div id="app"></div>
<script>
window.$docsify = {
name: 'mall-learning',
repo: 'https://github.com/macrozheng/mall-learning',
loadNavbar: true,
loadSidebar: true,
coverpage: true,
auto2top: true,
maxLevel: 2,
subMaxLevel: 3,
search: {
placeholder: '搜索',
noData: '找不到结果!',
depth: 3
},
alias: {
'/.*/_sidebar.md': '/_sidebar.md',//防止意外回退
'/.*/_navbar.md': '/_navbar.md'
},
ga: 'UA-144208445-1',
plugins: [
function(hook) {
var header = [
'<p>',
'<a href="https://www.aliyun.com/sale-season/2020/procurement-new-members?userCode=44mjc0yx">',
'<img src="/images/aliyun_sale.jpg" alt="阿里云" width="640px" height="60px">',
'</a>',
'</p>'
].join('');
var footer = [
'<hr/>',
'<footer style="text-align: center">',
'<span><a href="http://www.beian.miit.gov.cn/" target="_blank">苏ICP备19059396号-1</a></span>',
'</footer>'
].join('');
hook.afterEach(function (html) {
// var isReadme = window.location.href.indexOf("README");
var isReadme = 1;
if(isReadme===-1){
return header + html + footer;
}else{
return html + footer;
}
});
}
]
}
</script>
<script src="//unpkg.com/docsify@4.10.0/lib/docsify.min.js"></script>
<script src="//unpkg.com/docsify@4.10.0/lib/plugins/ga.js"></script>
<script src="//unpkg.com/docsify@4.10.0/lib/plugins/search.js"></script>
<script src="//unpkg.com/docsify-copy-code@2.1.0/dist/docsify-copy-code.min.js"></script>
<script src="//unpkg.com/prismjs@1.19.0/components/prism-bash.js"></script>
<script src="//unpkg.com/prismjs@1.19.0/components/prism-java.js"></script>
<script src="//unpkg.com/prismjs@1.19.0/components/prism-sql.js"></script>
</body>
</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
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
参考文章:
Docsify使用指南(打造最快捷、最轻量级的个人&团队文档) - 追逐时光者 - 博客园 (cnblogs.com) (opens new window)