Skip to content

Commit 770a5ab

Browse files
committed
refactor: build site with vitepress
1 parent 5b9ff64 commit 770a5ab

34 files changed

+326
-173
lines changed

.github/workflows/deploy.yml

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Build and deploy
2+
3+
on:
4+
push:
5+
branches: [main]
6+
workflow_dispatch:
7+
8+
jobs:
9+
docs:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- uses: actions/checkout@v4
14+
with:
15+
fetch-depth: 0
16+
17+
- name: Setup Node.js
18+
uses: actions/setup-node@v4
19+
with:
20+
node-version: 22
21+
cache: npm
22+
23+
- name: Setup Pages
24+
uses: actions/configure-pages@v4
25+
26+
- name: Install dependencies
27+
run: npm ci
28+
29+
- name: Build with VitePress
30+
run: npm run docs:build
31+
32+
- name: Deploy to GitHub Pages
33+
uses: crazy-max/ghaction-github-pages@v4
34+
with:
35+
target_branch: gh-pages
36+
build_dir: docs/.vitepress/dist
37+
fqdn: interview.doocs.org
38+
env:
39+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
40+
41+
build:
42+
runs-on: ubuntu-latest
43+
if: github.repository == 'doocs/coding-interview'
44+
needs: docs
45+
steps:
46+
- name: Sync to Gitee
47+
uses: wearerequired/git-mirror-action@master
48+
env:
49+
SSH_PRIVATE_KEY: ${{ secrets.GITEE_RSA_PRIVATE_KEY }}
50+
with:
51+
source-repo: git@github.com:doocs/coding-interview.git
52+
destination-repo: git@gitee.com:Doocs/coding-interview.git

.github/workflows/sync.yml

-27
This file was deleted.

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,7 @@ hs_err_pid*
2424

2525
node_modules
2626
*.json
27+
28+
29+
docs/.vitepress/dist
30+
docs/.vitepress/cache

.nojekyll

Whitespace-only changes.

CNAME

-1
This file was deleted.

_coverpage.md

-10
This file was deleted.

_navbar.md

-16
This file was deleted.

docs/.vitepress/config.mts

+69
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
import { defineConfig } from 'vitepress'
2+
3+
// https://vitepress.dev/reference/site-config
4+
export default defineConfig({
5+
title: "coding-interview",
6+
description: "互联网公司 IT 技术面试题集",
7+
themeConfig: {
8+
// https://vitepress.dev/reference/default-theme-config
9+
nav: [
10+
{ text: '首页', link: '/' },
11+
{ text: '题解', link: '/coding-interview' },
12+
{ text: '编程之美', link: '/the-beauty-of-programming' },
13+
{ text: '代码整洁之道', link: '/clean-code' },
14+
{ text: '阿里巴巴 Java 开发手册', link: '/effective-coding' },
15+
{ text: '枕边算法书', link: '/algorithm-stories' },
16+
{ text: 'Effective Java', link: '/effective-java' }
17+
],
18+
search: {
19+
provider: 'local'
20+
},
21+
logo: '/favicon-32x32.png',
22+
footer: {
23+
message: 'Released under the CC-BY-SA-4.0 license.',
24+
copyright: `版权所有 © 2018-${new Date().getFullYear()} <a href="https://github.com/doocs">Doocs</a>`
25+
},
26+
docFooter: {
27+
prev: '上一篇',
28+
next: '下一篇'
29+
},
30+
editLink: {
31+
pattern: 'https://github.com/doocs/coding-interview/edit/main/docs/:path',
32+
text: '在 GitHub 编辑'
33+
},
34+
sidebar: [
35+
{
36+
text: '📚 题解',
37+
items: [
38+
{ text: '剑指 Offer', link: '/coding-interview' },
39+
{ text: '编程之美', link: '/the-beauty-of-programming' }
40+
]
41+
},
42+
{
43+
text: '📝 代码整洁',
44+
items: [
45+
{ text: '代码整洁之道', link: '/clean-code' },
46+
{ text: '阿里巴巴 Java 开发手册', link: '/effective-coding' }
47+
]
48+
},
49+
{
50+
text: '📖 其他书籍',
51+
items: [
52+
{ text: '枕边算法书', link: '/algorithm-stories' },
53+
{ text: 'Effective Java', link: '/effective-java' }
54+
]
55+
}
56+
],
57+
58+
socialLinks: [
59+
{ icon: 'github', link: 'https://github.com/doocs/coding-interview' }
60+
]
61+
},
62+
head: [
63+
['link', { rel: 'icon', type: 'image/png', href: '/favicon-32x32.png' }],
64+
],
65+
cleanUrls: true,
66+
sitemap: {
67+
hostname: 'https://interview.doocs.org'
68+
}
69+
})

docs/.vitepress/theme/Layout.vue

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<template>
2+
<Layout>
3+
<template #doc-footer-before>
4+
<div
5+
style="
6+
margin-top: 40px;
7+
padding: 2em 0;
8+
text-align: center;
9+
border-top: 1px solid #e2e2e2;
10+
"
11+
>
12+
<table style="margin: 0 auto">
13+
<tbody>
14+
<tr>
15+
<td align="center" style="width: 260px">
16+
<img
17+
src="https://cdn-doocs.oss-cn-shenzhen.aliyuncs.com/gh/doocs/images/qrcode-for-doocs.png"
18+
style="width: 200px"
19+
/><br />
20+
</td>
21+
<td align="center" style="width: 260px">
22+
<img
23+
src="https://cdn-doocs.oss-cn-shenzhen.aliyuncs.com/gh/doocs/images/qrcode-for-yanglbme.png"
24+
style="width: 200px"
25+
/><br />
26+
</td>
27+
</tr>
28+
</tbody>
29+
</table>
30+
</div>
31+
</template>
32+
</Layout>
33+
</template>
34+
35+
<script setup>
36+
import DefaultTheme from 'vitepress/theme';
37+
const { Layout } = DefaultTheme;
38+
</script>

docs/.vitepress/theme/index.js

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import DefaultTheme from "vitepress/theme";
2+
import giscusTalk from "vitepress-plugin-comment-with-giscus";
3+
import { useData, useRoute } from "vitepress";
4+
import { toRefs } from "vue";
5+
import Layout from "./Layout.vue";
6+
7+
export default {
8+
extends: DefaultTheme,
9+
Layout: Layout,
10+
enhanceApp(ctx) {
11+
DefaultTheme.enhanceApp(ctx);
12+
},
13+
setup() {
14+
const { frontmatter } = toRefs(useData());
15+
const route = useRoute();
16+
17+
giscusTalk(
18+
{
19+
repo: "doocs/coding-interview",
20+
repoId: "MDEwOlJlcG9zaXRvcnkxNTQ5MTMxODI=",
21+
mapping: "pathname",
22+
category: "Announcements",
23+
categoryId: "IC_kwDOCTvJns4CpHBe",
24+
inputPosition: "top",
25+
lang: "zh-CN",
26+
homePageShowComment: true,
27+
loading: "lazying",
28+
lightTheme: "light",
29+
darkTheme: "transparent_dark",
30+
},
31+
{
32+
frontmatter,
33+
route,
34+
},
35+
true
36+
);
37+
},
38+
};

docs/algorithm-stories.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
有一天,岛上突然来了一位游客,她完全处于状况外。于是,她对和尚们说:“你们当中至少有一位的眼睛是红色的”。
1818

19-
![island-eye-color](/images/island-eye-color.jpg)
19+
![island-eye-color](./images/island-eye-color.jpg)
2020

2121
这名无心的游客当天就离开了小岛,而和尚们却因第一次听到有关眼睛颜色的话题而惴惴不安。当晚,小岛上开始出现了可怕的事情......
2222

@@ -159,7 +159,7 @@ boolean isLeapYear(int year) {
159159

160160
答案本身非常简单,不过能够真正求解的人却寥寥无几。想问题的时候,请不要考虑房间或水的温度,以及化学反应等“不讲理”的方法。另外,不允许喝杯子里的水。
161161

162-
![water-cup](/images/water-cup.jpg)
162+
![water-cup](./images/water-cup.jpg)
163163

164164
即使读完题没能马上想起答案,但看到插图后能够立刻明白,也可以说很有编程的感觉。将杯子倾斜,使水面刚好到达杯口时,查看杯底的水就能得出答案了。
165165

docs/coding-interview.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -1557,7 +1557,7 @@ class Solution {
15571557

15581558
#### 解法二
15591559

1560-
![odd-even](/images/odd-even.png)
1560+
![odd-even](./images/odd-even.png)
15611561

15621562
递归求解,每次 exponent 缩小一半,时间复杂度为 `O(log N)`
15631563

@@ -3165,18 +3165,18 @@ public class Solution {
31653165

31663166
输入一个复杂链表(每个节点中有节点值,以及两个指针,一个指向下一个节点,另一个特殊指针指向任意一个节点),返回结果为复制后复杂链表的 `head`。(注意,输出结果中请不要返回参数中的节点引用,否则判题程序会直接返回空)
31673167

3168-
![random-list](/images/random-list.png)
3168+
![random-list](./images/random-list.png)
31693169

31703170
### 解法
31713171

31723172
- 第一步,在每个节点的后面插入复制的节点;
3173-
![random-list-step1.png](/images/random-list-step1.png)
3173+
![random-list-step1.png](./images/random-list-step1.png)
31743174

31753175
- 第二步,对复制节点的 random 链接进行赋值;
3176-
![random-list-step2.png](/images/random-list-step2.png)
3176+
![random-list-step2.png](./images/random-list-step2.png)
31773177

31783178
- 第三步,分离两个链表。
3179-
![random-list-step3.png](/images/random-list-step3.png)
3179+
![random-list-step3.png](./images/random-list-step3.png)
31803180

31813181
```java
31823182
/*

docs/getting-started.md

+71
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# 互联网公司 IT 技术面试题集
2+
3+
[![license](https://badgen.net/github/license/doocs/leetcode?color=green)](https://github.com/doocs/coding-interview/blob/main/LICENSE)
4+
[![stars](https://badgen.net/github/stars/doocs/coding-interview)](https://github.com/doocs/coding-interview/stargazers)
5+
[![issues](https://badgen.net/github/open-issues/doocs/coding-interview)](https://github.com/doocs/coding-interview/issues)
6+
[![forks](https://img.shields.io/github/forks/doocs/coding-interview.svg)](https://github.com/doocs/coding-interview/network/members)
7+
[![PRs Welcome](https://badgen.net/badge/PRs/welcome/green)](http://makeapullrequest.com)
8+
9+
## 项目介绍
10+
11+
本仓库用于记录各大互联网公司 IT 技术面试高频题以及经典书籍读书笔记,包括《剑指 Offer》、《编程之美》、《代码整洁之道》等,抽空更新中。
12+
13+
## 站点
14+
15+
https://interview.doocs.org
16+
17+
## 书籍笔记
18+
19+
### [《剑指 Offer》](/coding-interview.md)
20+
21+
这本书选取的[题目](/coding-interview.md)都是被各大公司面试官反复采用的编程题,极具实战意义。当然,如果一开始觉得这些题目比较难,也是很正常的,因为大公司的面试本身就不简单。我们逐步掌握书中总结的解题方法之后,再去面试大公司,将会轻松很多。
22+
23+
推荐三个在线刷《剑指 Offer》的平台,个人比较倾向于 [LeetCode 中国](https://leetcode.cn/problemset/lcof/)
24+
25+
- [LeetCode 中国](https://leetcode.cn/problemset/lcof/):近期上线,支持多种编程语言,墙裂推荐。
26+
- [AcWing](https://www.acwing.com/problem/):支持 Java11。团队成员来自北大清华,剑指 Offer 第二版题目都有。
27+
- [NowCoder](https://www.nowcoder.com/ta/coding-interviews):这个应该大多数人都知道,但是没有剑指 Offer 第二版新增的题目。
28+
29+
### [《代码整洁之道》](/clean-code.md)
30+
31+
这本书名为 _Clean Code_,乃是 Object Mentor(鲍勃大叔开办的技术咨询和培训公司)一干大牛在编程方面的经验累积。写整洁代码,需要遵循大量的小技巧,贯彻刻苦习得的“整洁感”。
32+
33+
作者 Robert C. Martin 在书中阐述了代码各个方面如何做到整洁的经验与最佳实践。我们若能长期遵照这些经验编写代码,所谓“代码感”也就自然而然滋生出来。
34+
35+
### [《阿里巴巴 Java 开发手册》](/effective-coding.md)
36+
37+
别人都说我们是搬砖的码农,但我们知道自己是追求个性的艺术家。也许我们不会过多在意自己的外表和穿着,但在我们不羁的外表下,骨子里追求着代码的美、系统的美、设计的美,代码规范其实就是一个对程序美的定义。
38+
39+
### [《枕边算法书》](/algorithm-stories.md)
40+
41+
这本书,我是把它当作一本故事书来读的,里面的部分知识点还挺有意思。
42+
43+
### [《Effective Java》](/effective-java.md)
44+
45+
这本书共包含了 78 个条目,每个条目讨论一条规则。它适用于任何具有实际 Java 工作经验的工程师,对于高级工程师,也能够提供一些发人深思的东西,是所有 Java 工程师必读书籍之一。
46+
47+
---
48+
49+
## Doocs 社区优质项目
50+
51+
Doocs 技术社区,致力于打造一个内容完整、持续成长的互联网开发者学习生态圈!以下是 Doocs 旗下的一些优秀项目,欢迎各位开发者朋友持续保持关注。
52+
53+
| # | 项目 | 描述 | 热度 |
54+
| --- | ----------------------------------------------------------------- | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------- |
55+
| 1 | [advanced-java](https://github.com/doocs/advanced-java) | 互联网 Java 工程师进阶知识完全扫盲:涵盖高并发、分布式、高可用、微服务、海量数据处理等领域知识。 | ![](https://badgen.net/github/stars/doocs/advanced-java) <br>![](https://badgen.net/github/forks/doocs/advanced-java) |
56+
| 2 | [leetcode](https://github.com/doocs/leetcode) | 多种编程语言实现 LeetCode、《剑指 Offer(第 2 版)》、《程序员面试金典(第 6 版)》题解。 | ![](https://badgen.net/github/stars/doocs/leetcode) <br>![](https://badgen.net/github/forks/doocs/leetcode) |
57+
| 3 | [source-code-hunter](https://github.com/doocs/source-code-hunter) | 互联网常用组件框架源码分析。 | ![](https://badgen.net/github/stars/doocs/source-code-hunter) <br>![](https://badgen.net/github/forks/doocs/source-code-hunter) |
58+
| 4 | [jvm](https://github.com/doocs/jvm) | Java 虚拟机底层原理知识总结。 | ![](https://badgen.net/github/stars/doocs/jvm) <br>![](https://badgen.net/github/forks/doocs/jvm) |
59+
| 5 | [coding-interview](https://github.com/doocs/coding-interview) | 代码面试题集,包括《剑指 Offer》、《编程之美》等。 | ![](https://badgen.net/github/stars/doocs/coding-interview) <br>![](https://badgen.net/github/forks/doocs/coding-interview) |
60+
| 6 | [md](https://github.com/doocs/md) | 一款高度简洁的微信 Markdown 编辑器。 | ![](https://badgen.net/github/stars/doocs/md) <br>![](https://badgen.net/github/forks/doocs/md) |
61+
| 7 | [technical-books](https://github.com/doocs/technical-books) | 值得一看的技术书籍列表。 | ![](https://badgen.net/github/stars/doocs/technical-books) <br>![](https://badgen.net/github/forks/doocs/technical-books) |
62+
63+
## 贡献者
64+
65+
感谢以下所有朋友对 [Doocs 技术社区](https://github.com/doocs) 所做出的贡献,[参与项目维护请戳这儿](https://doocs.github.io/#/?id=how-to-join)
66+
67+
<!-- ALL-CONTRIBUTORS-LIST: START - Do not remove or modify this section -->
68+
69+
<a href="https://opencollective.com/doocs/contributors.svg?width=890&button=true"><img src="https://opencollective.com/doocs/contributors.svg?width=890&button=false" /></a>
70+
71+
<!-- ALL-CONTRIBUTORS-LIST: END -->

0 commit comments

Comments
 (0)