Skip to content

Commit 4944701

Browse files
committed
docs(guide): 添加导航组件和美化文档结构
为文档添加统一的导航路径组件和模块导航,美化首页布局 更新侧边栏样式和图标,增强文档可读性和导航体验
1 parent 24fca5a commit 4944701

6 files changed

Lines changed: 188 additions & 36 deletions

File tree

docs/.vitepress/config.js

Lines changed: 56 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -19,60 +19,83 @@ export default defineConfig({
1919
sidebar: {
2020
'/guide/': [
2121
{
22-
text: '基础语法',
22+
text: '📚 教程导航',
2323
items: [
24-
{ text: '变量和类型', link: '/guide/01-variables-and-types/' },
25-
{ text: '运算符', link: '/guide/02-operators/' },
26-
{ text: '输入输出', link: '/guide/03-input-output/' },
27-
{ text: '注释', link: '/guide/04-comments/' }
24+
{ text: '🏠 教程首页', link: '/guide/' },
25+
{ text: '📖 学习指南', link: '/guide/learning-guide' }
2826
]
2927
},
3028
{
31-
text: '控制结构',
29+
text: '🔤 基础语法',
3230
items: [
33-
{ text: '条件语句', link: '/guide/05-conditions/' },
34-
{ text: '循环', link: '/guide/06-loops/' },
35-
{ text: '循环控制', link: '/guide/07-loop-control/' }
31+
{ text: '📝 变量和类型', link: '/guide/01-variables-and-types/' },
32+
{ text: '🔢 运算符', link: '/guide/02-operators/' },
33+
{ text: '💬 输入输出', link: '/guide/03-input-output/' },
34+
{ text: '📋 注释', link: '/guide/04-comments/' }
3635
]
3736
},
3837
{
39-
text: '数据结构',
38+
text: '🔀 控制结构',
4039
items: [
41-
{ text: '列表', link: '/guide/08-lists/' },
42-
{ text: '元组', link: '/guide/09-tuples/' },
43-
{ text: '字典', link: '/guide/10-dictionaries/' },
44-
{ text: '集合', link: '/guide/11-sets/' },
45-
{ text: '字符串', link: '/guide/12-strings/' }
40+
{ text: '❓ 条件语句', link: '/guide/05-conditions/' },
41+
{ text: '🔄 循环', link: '/guide/06-loops/' },
42+
{ text: '⏹️ 循环控制', link: '/guide/07-loop-control/' }
43+
]
44+
},
45+
{
46+
text: '📊 数据结构',
47+
items: [
48+
{ text: '📋 列表', link: '/guide/08-lists/' },
49+
{ text: '📦 元组', link: '/guide/09-tuples/' },
50+
{ text: '🗂️ 字典', link: '/guide/10-dictionaries/' },
51+
{ text: '🎯 集合', link: '/guide/11-sets/' },
52+
{ text: '🔤 字符串', link: '/guide/12-strings/' }
4653
]
4754
}
4855
],
4956
'/guide/01-variables-and-types/': [
5057
{
51-
text: '变量和数据类型',
58+
text: '🧭 快速导航',
59+
items: [
60+
{ text: '🏠 返回教程首页', link: '/guide/' },
61+
{ text: '⬅️ 上一模块: 无', link: '#', class: 'disabled' },
62+
{ text: '➡️ 下一模块: 运算符', link: '/guide/02-operators/' }
63+
]
64+
},
65+
{
66+
text: '📝 变量和数据类型',
5267
items: [
53-
{ text: '模块概述', link: '/guide/01-variables-and-types/' },
54-
{ text: '基础变量', link: '/guide/01-variables-and-types/basic-variables' },
55-
{ text: '数据类型', link: '/guide/01-variables-and-types/data-types' },
56-
{ text: '动态类型', link: '/guide/01-variables-and-types/dynamic-typing' },
57-
{ text: '类型转换', link: '/guide/01-variables-and-types/type-conversion' },
58-
{ text: '变量命名', link: '/guide/01-variables-and-types/variable-naming' },
59-
{ text: '综合练习', link: '/guide/01-variables-and-types/exercises' }
68+
{ text: '📖 模块概述', link: '/guide/01-variables-and-types/' },
69+
{ text: '🔤 基础变量', link: '/guide/01-variables-and-types/basic-variables' },
70+
{ text: '🏷️ 数据类型', link: '/guide/01-variables-and-types/data-types' },
71+
{ text: '🔄 动态类型', link: '/guide/01-variables-and-types/dynamic-typing' },
72+
{ text: '🔀 类型转换', link: '/guide/01-variables-and-types/type-conversion' },
73+
{ text: '📝 变量命名', link: '/guide/01-variables-and-types/variable-naming' },
74+
{ text: '💪 综合练习', link: '/guide/01-variables-and-types/exercises' }
6075
]
6176
}
6277
],
6378
'/guide/02-operators/': [
6479
{
65-
text: '运算符',
80+
text: '🧭 快速导航',
81+
items: [
82+
{ text: '🏠 返回教程首页', link: '/guide/' },
83+
{ text: '⬅️ 上一模块: 变量和类型', link: '/guide/01-variables-and-types/' },
84+
{ text: '➡️ 下一模块: 输入输出', link: '/guide/03-input-output/' }
85+
]
86+
},
87+
{
88+
text: '🔢 运算符',
6689
items: [
67-
{ text: '模块概述', link: '/guide/02-operators/' },
68-
{ text: '算术运算符', link: '/guide/02-operators/arithmetic-operators' },
69-
{ text: '比较运算符', link: '/guide/02-operators/comparison-operators' },
70-
{ text: '逻辑运算符', link: '/guide/02-operators/logical-operators' },
71-
{ text: '赋值运算符', link: '/guide/02-operators/assignment-operators' },
72-
{ text: '位运算符', link: '/guide/02-operators/bitwise-operators' },
73-
{ text: '成员运算符', link: '/guide/02-operators/membership-operators' },
74-
{ text: '运算符优先级', link: '/guide/02-operators/operator-precedence' },
75-
{ text: '综合练习', link: '/guide/02-operators/exercises' }
90+
{ text: '📖 模块概述', link: '/guide/02-operators/' },
91+
{ text: '算术运算符', link: '/guide/02-operators/arithmetic-operators' },
92+
{ text: '⚖️ 比较运算符', link: '/guide/02-operators/comparison-operators' },
93+
{ text: '🔗 逻辑运算符', link: '/guide/02-operators/logical-operators' },
94+
{ text: '📝 赋值运算符', link: '/guide/02-operators/assignment-operators' },
95+
{ text: '🔢 位运算符', link: '/guide/02-operators/bitwise-operators' },
96+
{ text: '🔍 成员运算符', link: '/guide/02-operators/membership-operators' },
97+
{ text: '📊 运算符优先级', link: '/guide/02-operators/operator-precedence' },
98+
{ text: '💪 综合练习', link: '/guide/02-operators/exercises' }
7699
]
77100
}
78101
]

docs/guide/01-variables-and-types/basic-variables.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
# 基本变量定义和赋值
22

3+
::: tip 📍 导航路径
4+
[🏠 首页](/guide/) > [📊 变量和数据类型](/guide/01-variables-and-types/) > 基本变量定义和赋值
5+
:::
6+
7+
<div style="margin: 10px 0; padding: 10px; background: #f0f9ff; border-left: 4px solid #0ea5e9; border-radius: 4px;">
8+
<strong>🧭 快速导航:</strong>
9+
<a href="/guide/01-variables-and-types/" style="margin: 0 8px; color: #0ea5e9; text-decoration: none;">← 返回模块首页</a> |
10+
<a href="/guide/01-variables-and-types/data-types.md" style="margin: 0 8px; color: #0ea5e9; text-decoration: none;">下一节:数据类型 →</a>
11+
</div>
12+
313
## 学习目标
414

515
1. 理解什么是变量

docs/guide/01-variables-and-types/index.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,24 @@ A: 当需要将一种数据类型转换为另一种时,比如将字符串转
123123

124124
---
125125

126+
## 🧭 模块导航
127+
128+
<div style="display: flex; justify-content: space-between; align-items: center; margin: 20px 0; padding: 15px; background: #f6f8fa; border-radius: 8px; border-left: 4px solid #0366d6;">
129+
<div style="text-align: left;">
130+
<strong>⬅️ 上一模块</strong><br>
131+
<span style="color: #666;">暂无</span>
132+
</div>
133+
<div style="text-align: center;">
134+
<a href="/guide/" style="display: inline-block; padding: 8px 16px; background: #0366d6; color: white; text-decoration: none; border-radius: 4px; font-weight: bold;">🏠 返回教程首页</a>
135+
</div>
136+
<div style="text-align: right;">
137+
<strong>➡️ 下一模块</strong><br>
138+
<a href="/guide/02-operators/" style="color: #0366d6; text-decoration: none; font-weight: bold;">🔢 运算符</a>
139+
</div>
140+
</div>
141+
142+
---
143+
126144
**开始你的Python学习之旅吧!** 🚀
127145

128146
记住:编程是一门实践性很强的技能,多动手、多思考、多练习是成功的关键。

docs/guide/02-operators/arithmetic-operators.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
# 算术运算符
22

3+
::: tip 📍 导航路径
4+
[🏠 首页](/guide/) > [🔢 运算符](/guide/02-operators/) > 算术运算符
5+
:::
6+
7+
<div style="margin: 10px 0; padding: 10px; background: #f0f9ff; border-left: 4px solid #0ea5e9; border-radius: 4px;">
8+
<strong>🧭 快速导航:</strong>
9+
<a href="/guide/02-operators/" style="margin: 0 8px; color: #0ea5e9; text-decoration: none;">← 返回模块首页</a> |
10+
<a href="/guide/02-operators/comparison-operators.md" style="margin: 0 8px; color: #0ea5e9; text-decoration: none;">下一节:比较运算符 →</a>
11+
</div>
12+
313
算术运算符是Python中最基础也是最常用的运算符,用于执行数学计算。本章将详细介绍Python中的七种算术运算符及其应用。
414

515
## 学习目标

docs/guide/02-operators/index.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,4 +178,22 @@ A: 建议记住常用的几个,复杂表达式使用括号明确优先级。
178178
- 运算符重载(__add__, __eq__ 等魔法方法)
179179
- 表达式求值算法(中缀转后缀等)
180180
- 编译原理中的运算符处理
181-
- 不同编程语言的运算符差异
181+
- 不同编程语言的运算符差异
182+
183+
---
184+
185+
## 🧭 模块导航
186+
187+
<div style="display: flex; justify-content: space-between; align-items: center; margin: 20px 0; padding: 15px; background: #f6f8fa; border-radius: 8px; border-left: 4px solid #0366d6;">
188+
<div style="text-align: left;">
189+
<strong>⬅️ 上一模块</strong><br>
190+
<a href="/guide/01-variables-and-types/" style="color: #0366d6; text-decoration: none; font-weight: bold;">📊 变量和数据类型</a>
191+
</div>
192+
<div style="text-align: center;">
193+
<a href="/guide/" style="display: inline-block; padding: 8px 16px; background: #0366d6; color: white; text-decoration: none; border-radius: 4px; font-weight: bold;">🏠 返回教程首页</a>
194+
</div>
195+
<div style="text-align: right;">
196+
<strong>➡️ 下一模块</strong><br>
197+
<a href="/guide/03-input-output/" style="color: #0366d6; text-decoration: none; font-weight: bold;">💬 输入输出</a>
198+
</div>
199+
</div>

docs/guide/index.md

Lines changed: 75 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,83 @@
2929
- ✅ 使用Python标准库
3030
- ✅ 独立完成小型Python项目
3131

32+
## 📖 学习模块概览
33+
34+
### 🏗️ 基础语法
35+
36+
<div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 15px; margin: 20px 0;">
37+
38+
<div style="padding: 15px; border: 1px solid #e1e5e9; border-radius: 8px; background: #f8fafc;">
39+
<h4 style="margin: 0 0 10px 0; color: #0366d6;">📊 <a href="./01-variables-and-types/" style="color: inherit; text-decoration: none;">变量和数据类型</a></h4>
40+
<p style="margin: 0; font-size: 14px; color: #666;">学习Python的基础数据类型、变量定义和类型转换</p>
41+
<div style="margin-top: 8px; font-size: 12px; color: #888;">✅ 已完成文档</div>
42+
</div>
43+
44+
<div style="padding: 15px; border: 1px solid #e1e5e9; border-radius: 8px; background: #f8fafc;">
45+
<h4 style="margin: 0 0 10px 0; color: #0366d6;">🔢 <a href="./02-operators/" style="color: inherit; text-decoration: none;">运算符</a></h4>
46+
<p style="margin: 0; font-size: 14px; color: #666;">掌握算术、比较、逻辑等各种运算符的使用</p>
47+
<div style="margin-top: 8px; font-size: 12px; color: #888;">✅ 已完成文档</div>
48+
</div>
49+
50+
<div style="padding: 15px; border: 1px solid #e1e5e9; border-radius: 8px; background: #f0f0f0;">
51+
<h4 style="margin: 0 0 10px 0; color: #666;">💬 输入输出</h4>
52+
<p style="margin: 0; font-size: 14px; color: #666;">学习程序与用户的交互方法</p>
53+
<div style="margin-top: 8px; font-size: 12px; color: #888;">⏳ 待完成文档</div>
54+
</div>
55+
56+
<div style="padding: 15px; border: 1px solid #e1e5e9; border-radius: 8px; background: #f0f0f0;">
57+
<h4 style="margin: 0 0 10px 0; color: #666;">🔤 字符串处理</h4>
58+
<p style="margin: 0; font-size: 14px; color: #666;">深入学习字符串操作和格式化</p>
59+
<div style="margin-top: 8px; font-size: 12px; color: #888;">⏳ 待完成文档</div>
60+
</div>
61+
62+
</div>
63+
64+
### 🎛️ 控制结构
65+
66+
<div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 15px; margin: 20px 0;">
67+
68+
<div style="padding: 15px; border: 1px solid #e1e5e9; border-radius: 8px; background: #f0f0f0;">
69+
<h4 style="margin: 0 0 10px 0; color: #666;">🔀 条件语句</h4>
70+
<p style="margin: 0; font-size: 14px; color: #666;">学习if-elif-else条件判断</p>
71+
<div style="margin-top: 8px; font-size: 12px; color: #888;">⏳ 待完成文档</div>
72+
</div>
73+
74+
<div style="padding: 15px; border: 1px solid #e1e5e9; border-radius: 8px; background: #f0f0f0;">
75+
<h4 style="margin: 0 0 10px 0; color: #666;">🔄 循环结构</h4>
76+
<p style="margin: 0; font-size: 14px; color: #666;">掌握for和while循环的使用</p>
77+
<div style="margin-top: 8px; font-size: 12px; color: #888;">⏳ 待完成文档</div>
78+
</div>
79+
80+
</div>
81+
82+
### 📦 数据结构
83+
84+
<div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 15px; margin: 20px 0;">
85+
86+
<div style="padding: 15px; border: 1px solid #e1e5e9; border-radius: 8px; background: #f0f0f0;">
87+
<h4 style="margin: 0 0 10px 0; color: #666;">📋 列表和元组</h4>
88+
<p style="margin: 0; font-size: 14px; color: #666;">学习序列类型的操作方法</p>
89+
<div style="margin-top: 8px; font-size: 12px; color: #888;">⏳ 待完成文档</div>
90+
</div>
91+
92+
<div style="padding: 15px; border: 1px solid #e1e5e9; border-radius: 8px; background: #f0f0f0;">
93+
<h4 style="margin: 0 0 10px 0; color: #666;">🗂️ 字典和集合</h4>
94+
<p style="margin: 0; font-size: 14px; color: #666;">掌握映射和集合类型的使用</p>
95+
<div style="margin-top: 8px; font-size: 12px; color: #888;">⏳ 待完成文档</div>
96+
</div>
97+
98+
</div>
99+
32100
## 🚀 开始学习
33101

34-
准备好了吗?让我们从[变量和类型](./01-variables-and-types/)开始你的Python编程之旅!
102+
准备好了吗?让我们从 **[📊 变量和数据类型](./01-variables-and-types/)** 开始你的Python编程之旅!
103+
104+
<div style="text-align: center; margin: 30px 0; padding: 20px; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); border-radius: 10px; color: white;">
105+
<h3 style="margin: 0 0 10px 0;">🎯 学习路径建议</h3>
106+
<p style="margin: 0;">基础语法 → 控制结构 → 数据结构 → 函数 → 面向对象 → 高级特性</p>
107+
</div>
35108

36109
---
37110

38-
*提示:如果你是编程新手,建议先了解一些基本的计算机概念。如果你有其他编程语言经验,可以适当加快学习进度。*
111+
*💡 提示:如果你是编程新手,建议先了解一些基本的计算机概念。如果你有其他编程语言经验,可以适当加快学习进度。*

0 commit comments

Comments
 (0)