Skip to content

Commit 1b2a37a

Browse files
authored
Merge pull request #73 from InvolutionHell/newCountribute
更新了教程,如何贡献
2 parents 986e6a0 + 3dc3585 commit 1b2a37a

File tree

19 files changed

+124
-164
lines changed

19 files changed

+124
-164
lines changed

CONTRIBUTING.md

Lines changed: 65 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,102 +1,104 @@
11
# 贡献指南/Contributing Guide
22

3+
## 投稿指南
34

5+
1. 在首页点击「我要投稿」,或在任意文档右上角使用「编辑」/「我要投稿」按钮
6+
![button](./public/git_assets/button.png)
47

8+
2. 浮窗中选择想贡献的章节,也可以先新建一个文件夹
9+
![setting](./public//git_assets/setting.png)
10+
![setting2](./public//git_assets/setting2.png)
11+
选好后点击「下一步」
512

6-
## ✍️ 添加新文章
13+
3. 页面会跳转到 GitHub,新建文档时请保留顶部 Frontmatter 结构
14+
![file](./public//git_assets/file.png)
715

8-
### 步骤1:选择位置
16+
4. 点击 `Commit changes`,若是第一次投稿,GitHub 会提示先 Fork 仓库;按提示操作一次即可
17+
![fork](./public//git_assets/need_fork.png)
918

10-
确定你的文章在现有结构中的位置:
19+
5. Fork 完成后会自动返回原页面,然后一直“下一步”即可
20+
![after_fork](./public//git_assets/after_fork.png)
21+
再点击一次 `Commit changes`
22+
![propose](./public//git_assets/propse_changes.png)
23+
随后进入 PR 流程,按提示一路继续
24+
![pr1](./public//git_assets/pr.png)
25+
![pr2](./public//git_assets/pr2.png)
1126

12-
```bash
13-
# 示例:添加新的数据结构主题
14-
docs/computer-science/data-structures/new-topic/
15-
16-
# 示例:为现有主题添加文章
17-
docs/computer-science/data-structures/array/03-new-array-type.mdx
18-
```
27+
6. 恭喜你完成了首次 Pull Request! 🎉
28+
![success](./public//git_assets/succuess.png)
1929

20-
### 步骤2:创建文件
30+
—— 以下是代码贡献流程,若只提交文档可在此结束 ——
2131

22-
创建新的 `.mdx` 文件,并包含正确的 Frontmatter:
23-
24-
```bash
25-
# 如需要创建目录
26-
mkdir -p docs/computer-science/data-structures/new-topic
32+
---
2733

28-
# 创建文件
29-
touch docs/computer-science/data-structures/new-topic/index.mdx
30-
```
34+
## Git 提交 Guide
3135

32-
### 步骤3:编写内容
36+
#### 1. 将本项目直接fork到自己的账号下,这样就可以直接在自己的账号下进行修改和提交。
3337

34-
使用 Markdown/MDX 编写文章:
38+
![fork1](./public//git_assets/fork1.jpg)
39+
![fork2](./public//git_assets/fork2.png)
3540

36-
```mdx
37-
---
38-
title: "文章标题"
39-
description: "文章简短描述"
40-
date: "2024-01-15"
41-
tags:
42-
- your-topic
43-
- another-tag
44-
---
41+
_注意取消勾选仅克隆当前分支_
4542

46-
# 文章标题
43+
#### 2. 克隆项目
4744

48-
## 引言
45+
```
46+
git clone https://github.com/你自己的仓库名/involutionhell.github.io.git
47+
```
4948

50-
这里是内容...
49+
修改为自己fork的仓库,改为你的https仓库的git地址
5150

52-
## 第一节
51+
#### 3. 创建自己的分支
5352

54-
更多内容...
53+
列出现有分支
5554

56-
## 代码示例
55+
```
56+
git branch -a #用于列出当前Git仓库中所有的分支,包括本地分支和远程分支。
5757
```
5858

59-
### 步骤4:测试修改
59+
![branch-all](./public//git_assets/branch-all.png)
6060

61-
使用 Fumadocs 验证内容:
61+
##### 3.1 创建功能分支的约定命名
6262

63-
```bash
64-
pnpm build
65-
pnpm migrate:images # 迁移图片脚本
6663
```
64+
git checkout -b feat/your-feature
6765
68-
此命令将:
66+
# 它的作用是创建一个新的分支并立即切换到该分支上。
6967
70-
- 验证 Frontmatter 语法
71-
- 检查 MDX 错误
72-
- 生成预览内容
68+
具体来说,这个命令相当于同时执行了两个操作:
69+
git branch feat/your-feature - 创建名为 feat/your-feature 的新分支
70+
git checkout feat/your-feature - 切换到这个新创建的分支
7371
74-
### 步骤5:本地预览
72+
其中 feat/your-feature 是分支名称,通常遵循约定式命名:
7573
76-
启动开发服务器并预览修改:
77-
78-
```bash
79-
pnpm dev
74+
feat/ 前缀表示这是一个功能(feature)分支
75+
后面的 your-feature 通常是对功能的简要描述
8076
```
8177

82-
访问 `http://localhost:3000` 查看新内容。
83-
84-
### 步骤6:提交 PR
78+
##### 3.2 创建文档分支的约定命名
8579

86-
1. 提交修改:
80+
```
81+
git checkout -b doc_raven # 自定义一个新的分支
82+
#git checkout -b doc_id 分支名字改为你的uid分支名称
83+
```
8784

88-
```bash
89-
git add .
90-
git commit -m "Add: New article about [topic]"
91-
```
85+
#### 4. 提交更改分支
9286

93-
2. 推送到你的 fork:
87+
```
88+
git add .
89+
根据你的变动情况
90+
git commit -m "add xxx" # 添加信息记录
91+
or
92+
git commit -m "edit xxx" # 修改信息记录
93+
or
94+
git commit -m "delete xxx" #删除信息记录
95+
```
9496

95-
```bash
96-
git push origin feat/your-article
97-
```
97+
#### 5. 推送分支到远程仓库
9898

99-
3. 创建 Pull Request
99+
```
100+
git push origin doc_raven
101+
```
100102

101103
---
102104

Git/GIT_GUIDE.md

Lines changed: 0 additions & 54 deletions
This file was deleted.

app/components/Contribute.tsx

Lines changed: 57 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -141,65 +141,77 @@ export function Contribute() {
141141
}
142142
}}
143143
>
144-
<DialogTrigger asChild>
145-
<Button
146-
variant="hero"
147-
size="lg"
148-
className="relative isolate w-full sm:w-auto mt-12 h-16 md:h-20 px-10 md:px-14 rounded-full
144+
<div className="relative mt-12 inline-flex w-full sm:w-auto">
145+
<DialogTrigger asChild>
146+
<Button
147+
variant="hero"
148+
size="lg"
149+
className="relative isolate w-full sm:w-auto h-16 md:h-20 px-10 md:px-14 rounded-none
149150
text-lg md:text-2xl font-semibold tracking-wide overflow-hidden
150151
shadow-xl ring-1 ring-white/30 dark:ring-white/10
151152
bg-gradient-to-r from-sky-300 via-sky-400 to-blue-600
152153
dark:from-indigo-950 dark:via-slate-900 dark:to-black
153154
hover:shadow-[0_25px_60px_-12px] hover:scale-[1.03] transition-all duration-300 ease-out"
154-
>
155-
{/* Day gradient shimmer */}
156-
<span
157-
aria-hidden
158-
className="pointer-events-none absolute -inset-1 opacity-30 blur-2xl transition-opacity duration-500
159-
bg-gradient-to-r from-sky-200 via-blue-300 to-sky-400 dark:opacity-0"
160-
/>
161-
{/* Night nebula glow */}
162-
<span
163-
aria-hidden
164-
className="pointer-events-none absolute -inset-1 opacity-0 blur-2xl transition-opacity duration-500
165-
dark:opacity-25 dark:bg-gradient-to-br dark:from-indigo-800 dark:via-fuchsia-700/50 dark:to-blue-900"
166-
/>
167-
168-
{/* Day clouds */}
169-
<span
170-
aria-hidden
171-
className={`absolute -left-12 top-1/3 w-48 h-24 rounded-full bg-white/60 blur-2xl dark:hidden ${styles.driftSlow}`}
172-
/>
173-
<span
174-
aria-hidden
175-
className={`absolute left-1/3 -bottom-8 w-64 h-28 rounded-full bg-white/40 blur-3xl dark:hidden ${styles.driftFast}`}
176-
/>
177-
178-
{/* Night stars */}
179-
<span aria-hidden className="hidden dark:block">
155+
>
156+
{/* Day gradient shimmer */}
180157
<span
181-
className={`absolute left-6 top-3 w-1 h-1 rounded-full bg-white/90 ${styles.twinkle}`}
158+
aria-hidden
159+
className="pointer-events-none absolute -inset-1 opacity-30 blur-2xl transition-opacity duration-500
160+
bg-gradient-to-r from-sky-200 via-blue-300 to-sky-400 dark:opacity-0"
182161
/>
162+
{/* Night nebula glow */}
183163
<span
184-
className={`absolute left-1/3 top-2 w-1 h-1 rounded-full bg-white/80 ${styles.twinkleDelay1}`}
185-
/>
186-
<span
187-
className={`absolute left-2/3 top-5 w-1 h-1 rounded-full bg-white/70 ${styles.twinkleDelay2}`}
164+
aria-hidden
165+
className="pointer-events-none absolute -inset-1 opacity-0 blur-2xl transition-opacity duration-500
166+
dark:opacity-25 dark:bg-gradient-to-br dark:from-indigo-800 dark:via-fuchsia-700/50 dark:to-blue-900"
188167
/>
168+
169+
{/* Day clouds */}
189170
<span
190-
className={`absolute right-8 top-4 w-1 h-1 rounded-full bg-white/90 ${styles.twinkleDelay3}`}
171+
aria-hidden
172+
className={`absolute -left-12 top-1/3 w-48 h-24 rounded-full bg-white/60 blur-2xl dark:hidden ${styles.driftSlow}`}
191173
/>
192174
<span
193-
className={`absolute right-1/4 bottom-3 w-1 h-1 rounded-full bg-white/80 ${styles.twinkle}`}
175+
aria-hidden
176+
className={`absolute left-1/3 -bottom-8 w-64 h-28 rounded-full bg-white/40 blur-3xl dark:hidden ${styles.driftFast}`}
194177
/>
195-
</span>
196178

197-
<span className="relative z-10 flex items-center gap-3 text-white">
198-
<Sparkles className="h-6 w-6 opacity-95" />
199-
<span className={styles.textGlow}>我要投稿</span>
200-
</span>
201-
</Button>
202-
</DialogTrigger>
179+
{/* Night stars */}
180+
<span aria-hidden className="hidden dark:block">
181+
<span
182+
className={`absolute left-6 top-3 w-1 h-1 rounded-full bg-white/90 ${styles.twinkle}`}
183+
/>
184+
<span
185+
className={`absolute left-1/3 top-2 w-1 h-1 rounded-full bg-white/80 ${styles.twinkleDelay1}`}
186+
/>
187+
<span
188+
className={`absolute left-2/3 top-5 w-1 h-1 rounded-full bg-white/70 ${styles.twinkleDelay2}`}
189+
/>
190+
<span
191+
className={`absolute right-8 top-4 w-1 h-1 rounded-full bg-white/90 ${styles.twinkleDelay3}`}
192+
/>
193+
<span
194+
className={`absolute right-1/4 bottom-3 w-1 h-1 rounded-full bg-white/80 ${styles.twinkle}`}
195+
/>
196+
</span>
197+
198+
<span className="relative z-10 flex items-center gap-3 text-white">
199+
<Sparkles className="h-6 w-6 opacity-95" />
200+
<span className={styles.textGlow}>我要投稿</span>
201+
</span>
202+
</Button>
203+
</DialogTrigger>
204+
<a
205+
href="https://github.com/InvolutionHell/involutionhell.github.io?tab=contributing-ov-file#%EF%B8%8F-%E6%B7%BB%E5%8A%A0%E6%96%B0%E6%96%87%E7%AB%A0"
206+
target="_blank"
207+
rel="noopener noreferrer"
208+
aria-label="查看投稿指南"
209+
title="查看投稿指南"
210+
className="absolute top-0 right-0 flex h-9 w-9 translate-x-1/2 -translate-y-1/2 items-center justify-center rounded-full border border-white/80 bg-white text-sky-600 shadow-lg ring-1 ring-sky-400/60 transition-transform hover:-translate-y-1/2 hover:translate-x-1/2 hover:scale-105 hover:shadow-xl dark:border-slate-700 dark:bg-slate-900 dark:text-sky-300"
211+
>
212+
<span className="text-lg font-semibold">?</span>
213+
</a>
214+
</div>
203215
<DialogContent className="sm:max-w-2xl">
204216
<DialogHeader>
205217
<DialogTitle>我要投稿</DialogTitle>

app/components/Hero.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,12 @@ export function Hero() {
5757
</p>
5858

5959
<div className="mt-8 flex flex-col sm:flex-row items-center justify-center gap-3">
60-
<Button asChild>
60+
<Button asChild className="rounded-none">
6161
<a href="/docs/ai" target="_blank" rel="noopener noreferrer">
6262
访问知识库 <ExternalLink className="ml-2 h-4 w-4" />
6363
</a>
6464
</Button>
65-
<Button variant="outline" asChild>
65+
<Button variant="outline" asChild className="rounded-none">
6666
<a
6767
href="https://github.com/involutionhell"
6868
target="_blank"

public/git_assets/GIT_GUIDE.md

Whitespace-only changes.

public/git_assets/after_fork.png

379 KB
Loading

public/git_assets/button.png

205 KB
Loading

public/git_assets/file.png

305 KB
Loading

0 commit comments

Comments
 (0)