Skip to content

Commit 8a9f15c

Browse files
authored
chore: separate configuration (doocs#291)
1 parent 806ce10 commit 8a9f15c

File tree

3 files changed

+115
-116
lines changed

3 files changed

+115
-116
lines changed

index.html

Lines changed: 1 addition & 115 deletions
Original file line numberDiff line numberDiff line change
@@ -48,121 +48,7 @@
4848
</ul>
4949
</nav>
5050
<div id="app">本系列知识由 Doocs 技术社区总结发布</div>
51-
<script>
52-
window.$docsify = {
53-
name: 'advanced-java',
54-
repo: 'doocs/advanced-java',
55-
lastModifiedText: '最近更新时间:',
56-
maxLevel: 3,
57-
auto2top: true,
58-
coverpage: true,
59-
coverpage: 'docs/extra-page/cover.md',
60-
loadSidebar: 'summary.md',
61-
alias: {
62-
'/.*/.*/summary': 'summary.md',
63-
'/.*/summary.md': 'summary.md',
64-
},
65-
pagination: {
66-
previousText: '上一篇',
67-
nextText: '下一篇',
68-
crossChapter: true,
69-
crossChapterText: true,
70-
},
71-
contributors: {
72-
repo: 'doocs/advanced-java',
73-
ignores: ['/README.md'],
74-
image: {
75-
margin: '0.2em',
76-
isRound: true,
77-
},
78-
},
79-
search: {
80-
maxAge: 1800000,
81-
paths: [
82-
'/docs/high-concurrency/',
83-
'/docs/distributed-system/',
84-
'/docs/high-availability/',
85-
'/docs/micro-services/',
86-
'/docs/big-data/',
87-
],
88-
depth: 3,
89-
},
90-
darklightTheme: {
91-
defaultTheme: 'light',
92-
siteFont: 'Source Sans Pro,Helvetica Neue,Arial,sans-serif',
93-
codeFontFamily: 'Roboto Mono, Monaco, courier, monospace',
94-
bodyFontSize: '15px',
95-
dark: {
96-
background: 'rgb(28,32,34)',
97-
highlightColor: '#e96900',
98-
codeBackgroundColor: 'rgb(34,39,46)',
99-
codeTextColor: '#b4b4b4',
100-
},
101-
light: {
102-
highlightColor: '#e96900',
103-
},
104-
},
105-
plugins: [
106-
function (hook, vm) {
107-
hook.beforeEach(function (content) {
108-
const { file, path } = vm.route;
109-
const en = file.indexOf('README_EN') > -1;
110-
if (/githubusercontent\.com/.test(file)) {
111-
url = file
112-
.replace(
113-
'raw.githubusercontent.com',
114-
'github.com',
115-
)
116-
.replace(/\/main/, '/blob/main');
117-
} else {
118-
url = `https://github.com/doocs/advanced-java/blob/main/${file}`;
119-
}
120-
121-
const github = `[GitHub](${url})`;
122-
const gitee = `[Gitee](${url.replace('github', 'gitee' )})`;
123-
124-
const editHtml = en
125-
? `:memo: Edit on ${github} / ${gitee}\n`
126-
: `:memo: 在 ${github} / ${gitee} 编辑\n`;
127-
128-
if (path === '/') {
129-
return editHtml + content;
130-
}
131-
const subscription = `---
132-
## 公众号
133-
134-
[Doocs](https://github.com/doocs) 技术社区旗下唯一公众号「**Doocs**」​,欢迎扫码关注,**专注分享技术领域相关知识及业内最新资讯**。当然,也可以加我个人微信(备注:GitHub),拉你进技术交流群。
135-
136-
关注「**Doocs**」公众号,回复 **PDF**,即可获取本项目离线 PDF 文档,学习更加方便!
137-
138-
<table>
139-
<tr>
140-
<td align="center" style="width: 200px;">
141-
<a href="https://github.com/doocs">
142-
<img src="./images/qrcode-for-doocs.jpg" style="width: 400px;"><br>
143-
<sub>公众平台</sub>
144-
</a><br>
145-
</td>
146-
<td align="center" style="width: 200px;">
147-
<a href="https://github.com/yanglbme">
148-
<img src="./images/qrcode-for-yanglbme.jpg" style="width: 400px;"><br>
149-
<sub>个人微信</sub>
150-
</a><br>
151-
</td>
152-
</tr>
153-
</table>`;
154-
return editHtml + content + `\n` + subscription;
155-
});
156-
157-
hook.afterEach(function (html) {
158-
const currentYear = new Date().getFullYear();
159-
const footer = `<footer><span>Copyright © 2018-${currentYear} <a href="https://github.com/doocs" target="_blank">Doocs</a>. All Rights Reserved.</footer>`;
160-
return html + footer;
161-
});
162-
},
163-
],
164-
};
165-
</script>
51+
<script src="./main.js"></script>
16652
<script src="https://cdn-doocs.oss-cn-shenzhen.aliyuncs.com/npm/docsify/lib/docsify.min.js"></script>
16753
<script src="https://cdn-doocs.oss-cn-shenzhen.aliyuncs.com/npm/prismjs/components/prism-java.min.js"></script>
16854
<script src="https://cdn-doocs.oss-cn-shenzhen.aliyuncs.com/npm/docsify-copy-code@2.1.1/dist/docsify-copy-code.min.js"></script>

main.js

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
window.$docsify = {
2+
name: 'advanced-java',
3+
repo: 'doocs/advanced-java',
4+
lastModifiedText: '最近更新时间:',
5+
maxLevel: 3,
6+
auto2top: true,
7+
coverpage: true,
8+
coverpage: 'docs/extra-page/cover.md',
9+
loadSidebar: 'summary.md',
10+
alias: {
11+
'/.*/.*/summary': 'summary.md',
12+
'/.*/summary.md': 'summary.md',
13+
},
14+
pagination: {
15+
previousText: '上一篇',
16+
nextText: '下一篇',
17+
crossChapter: true,
18+
crossChapterText: true,
19+
},
20+
contributors: {
21+
repo: 'doocs/advanced-java',
22+
ignores: ['/README.md'],
23+
image: {
24+
margin: '0.2em',
25+
isRound: true,
26+
},
27+
},
28+
search: {
29+
maxAge: 1800000,
30+
paths: [
31+
'/docs/high-concurrency/',
32+
'/docs/distributed-system/',
33+
'/docs/high-availability/',
34+
'/docs/micro-services/',
35+
'/docs/big-data/',
36+
],
37+
depth: 3,
38+
},
39+
darklightTheme: {
40+
defaultTheme: 'light',
41+
siteFont: 'Source Sans Pro,Helvetica Neue,Arial,sans-serif',
42+
codeFontFamily: 'Roboto Mono, Monaco, courier, monospace',
43+
bodyFontSize: '15px',
44+
dark: {
45+
background: 'rgb(28,32,34)',
46+
highlightColor: '#e96900',
47+
codeBackgroundColor: 'rgb(34,39,46)',
48+
codeTextColor: '#b4b4b4',
49+
},
50+
light: {
51+
highlightColor: '#e96900',
52+
},
53+
},
54+
plugins: [
55+
function (hook, vm) {
56+
hook.beforeEach(function (content) {
57+
const { file, path } = vm.route;
58+
const en = file.indexOf('README_EN') > -1;
59+
if (/githubusercontent\.com/.test(file)) {
60+
url = file
61+
.replace(
62+
'raw.githubusercontent.com',
63+
'github.com',
64+
)
65+
.replace(/\/main/, '/blob/main');
66+
} else {
67+
url = `https://github.com/doocs/advanced-java/blob/main/${file}`;
68+
}
69+
70+
const github = `[GitHub](${url})`;
71+
const gitee = `[Gitee](${url.replace('github', 'gitee' )})`;
72+
73+
const editHtml = en
74+
? `:memo: Edit on ${github} / ${gitee}\n`
75+
: `:memo: 在 ${github} / ${gitee} 编辑\n`;
76+
77+
if (path === '/') {
78+
return editHtml + content;
79+
}
80+
const subscription = `---
81+
## 公众号
82+
83+
[Doocs](https://github.com/doocs) 技术社区旗下唯一公众号「**Doocs**」​,欢迎扫码关注,**专注分享技术领域相关知识及业内最新资讯**。当然,也可以加我个人微信(备注:GitHub),拉你进技术交流群。
84+
85+
关注「**Doocs**」公众号,回复 **PDF**,即可获取本项目离线 PDF 文档,学习更加方便!
86+
87+
<table>
88+
<tr>
89+
<td align="center" style="width: 200px;">
90+
<a href="https://github.com/doocs">
91+
<img src="./images/qrcode-for-doocs.jpg" style="width: 400px;"><br>
92+
<sub>公众平台</sub>
93+
</a><br>
94+
</td>
95+
<td align="center" style="width: 200px;">
96+
<a href="https://github.com/yanglbme">
97+
<img src="./images/qrcode-for-yanglbme.jpg" style="width: 400px;"><br>
98+
<sub>个人微信</sub>
99+
</a><br>
100+
</td>
101+
</tr>
102+
</table>`;
103+
return editHtml + content + `\n` + subscription;
104+
});
105+
106+
hook.afterEach(function (html) {
107+
const currentYear = new Date().getFullYear();
108+
const footer = `<footer><span>Copyright © 2018-${currentYear} <a href="https://github.com/doocs" target="_blank">Doocs</a>. All Rights Reserved.</footer>`;
109+
return html + footer;
110+
});
111+
},
112+
],
113+
};

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"scripts": {
3-
"dev": "docsify serve --open",
3+
"start": "docsify serve --open",
44
"convert": "docsify-pdf-converter"
55
},
66
"name": "advanced-java",

0 commit comments

Comments
 (0)