@astro-minimax/cli 0.7.1 → 0.7.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +12 -2
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/profile.d.ts.map +1 -1
- package/dist/commands/profile.js +7 -2
- package/dist/commands/profile.js.map +1 -1
- package/dist/tools/build-fact-registry.d.ts +14 -0
- package/dist/tools/build-fact-registry.d.ts.map +1 -0
- package/dist/tools/build-fact-registry.js +545 -0
- package/dist/tools/build-fact-registry.js.map +1 -0
- package/package.json +3 -2
- package/template/.gitignore +7 -0
- package/template/datas/fact-registry.json +17 -0
- package/template/eslint.config.js +3 -0
- package/template/functions/api/chat.ts +6 -1
- package/template/package.json +8 -6
- package/template/src/config.ts +10 -2
- package/template/src/data/blog/zh/alerts-examples.md +86 -0
- package/template/src/data/blog/zh/code-examples.md +168 -0
- package/template/src/data/blog/zh/markmap-examples.md +103 -0
- package/template/src/data/blog/zh/math-examples.md +81 -0
- package/template/src/data/blog/zh/mermaid-examples.md +82 -0
package/template/package.json
CHANGED
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
"type": "module",
|
|
4
4
|
"version": "0.1.0",
|
|
5
5
|
"scripts": {
|
|
6
|
-
"dev": "astro dev",
|
|
6
|
+
"dev": "concurrently -n \"astro,ai\" -c \"blue,green\" \"astro dev\" \"pnpm exec astro-ai-dev\"",
|
|
7
|
+
"dev:astro": "astro dev",
|
|
7
8
|
"dev:ai": "pnpm exec astro-ai-dev",
|
|
8
9
|
"build": "astro check && astro build && pagefind --site dist && cp -r dist/pagefind public/",
|
|
9
10
|
"preview": "wrangler pages dev dist",
|
|
@@ -27,10 +28,10 @@
|
|
|
27
28
|
"dependencies": {
|
|
28
29
|
"@ai-sdk/openai-compatible": "^2.0.35",
|
|
29
30
|
"@ai-sdk/react": "^3.0.118",
|
|
30
|
-
"@astro-minimax/ai": "^0.
|
|
31
|
-
"@astro-minimax/core": "^0.
|
|
32
|
-
"@astro-minimax/notify": "^0.
|
|
33
|
-
"@astro-minimax/viz": "^0.
|
|
31
|
+
"@astro-minimax/ai": "^0.7.2",
|
|
32
|
+
"@astro-minimax/core": "^0.7.2",
|
|
33
|
+
"@astro-minimax/notify": "^0.7.2",
|
|
34
|
+
"@astro-minimax/viz": "^0.7.2",
|
|
34
35
|
"@astrojs/mdx": "^5.0.0",
|
|
35
36
|
"@astrojs/preact": "^5.0.0",
|
|
36
37
|
"@astrojs/rss": "^4.0.17",
|
|
@@ -57,12 +58,13 @@
|
|
|
57
58
|
"tailwindcss": "^4.2.1"
|
|
58
59
|
},
|
|
59
60
|
"devDependencies": {
|
|
60
|
-
"@astro-minimax/cli": "^0.
|
|
61
|
+
"@astro-minimax/cli": "^0.7.2",
|
|
61
62
|
"@astrojs/check": "^0.9.6",
|
|
62
63
|
"@cloudflare/workers-types": "^4.20260313.1",
|
|
63
64
|
"@pagefind/default-ui": "^1.4.0",
|
|
64
65
|
"@shikijs/transformers": "^4.0.2",
|
|
65
66
|
"@types/lodash.kebabcase": "^4.1.9",
|
|
67
|
+
"concurrently": "^9.1.2",
|
|
66
68
|
"eslint": "^9.39.3",
|
|
67
69
|
"eslint-plugin-astro": "^1.6.0",
|
|
68
70
|
"globals": "^16.5.0",
|
package/template/src/config.ts
CHANGED
|
@@ -36,9 +36,9 @@ export const SITE: SiteConfig = {
|
|
|
36
36
|
{ key: "tags", enabled: true },
|
|
37
37
|
{ key: "categories", enabled: true },
|
|
38
38
|
{ key: "series", enabled: true },
|
|
39
|
-
{ key: "projects", enabled:
|
|
39
|
+
{ key: "projects", enabled: false }, // Matches features.projects
|
|
40
40
|
{ key: "about", enabled: true },
|
|
41
|
-
{ key: "friends", enabled:
|
|
41
|
+
{ key: "friends", enabled: false }, // Matches features.friends
|
|
42
42
|
{ key: "archives", enabled: true },
|
|
43
43
|
],
|
|
44
44
|
},
|
|
@@ -109,7 +109,15 @@ export const SITE: SiteConfig = {
|
|
|
109
109
|
apiEndpoint: "/api/chat",
|
|
110
110
|
},
|
|
111
111
|
|
|
112
|
+
get lightAndDarkMode() {
|
|
113
|
+
return this.features?.darkMode;
|
|
114
|
+
},
|
|
115
|
+
|
|
112
116
|
get showArchives() {
|
|
113
117
|
return this.features?.archives ?? true;
|
|
114
118
|
},
|
|
119
|
+
|
|
120
|
+
get aiEnabled() {
|
|
121
|
+
return (this.features?.ai ?? false) && (this.ai?.enabled ?? false);
|
|
122
|
+
},
|
|
115
123
|
};
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "GitHub Alerts 示例"
|
|
3
|
+
description: "展示 GitHub 风格的提示框功能,支持多种类型"
|
|
4
|
+
pubDatetime: 2024-01-06T00:00:00.000Z
|
|
5
|
+
tags:
|
|
6
|
+
- 教程
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## 什么是 GitHub Alerts?
|
|
10
|
+
|
|
11
|
+
GitHub Alerts 是 GitHub 风格的提示框,可以用来强调重要信息、警告或提示。
|
|
12
|
+
|
|
13
|
+
## 基础用法
|
|
14
|
+
|
|
15
|
+
> [!NOTE]
|
|
16
|
+
> 这是一个普通的提示信息,用于补充说明。
|
|
17
|
+
|
|
18
|
+
> [!TIP]
|
|
19
|
+
> 这是一个小技巧,可以帮助用户更好地使用某些功能。
|
|
20
|
+
|
|
21
|
+
> [!IMPORTANT]
|
|
22
|
+
> 这是重要信息,用户应该特别注意。
|
|
23
|
+
|
|
24
|
+
> [!WARNING]
|
|
25
|
+
> 这是警告信息,提醒用户注意潜在的风险。
|
|
26
|
+
|
|
27
|
+
> [!CAUTION]
|
|
28
|
+
> 这是危险警告,提醒用户可能造成不可逆的操作。
|
|
29
|
+
|
|
30
|
+
## 实际使用场景
|
|
31
|
+
|
|
32
|
+
### 配置说明
|
|
33
|
+
|
|
34
|
+
> [!NOTE]
|
|
35
|
+
> 请确保在运行前配置好 `.env` 文件中的环境变量。
|
|
36
|
+
|
|
37
|
+
### 性能优化
|
|
38
|
+
|
|
39
|
+
> [!TIP]
|
|
40
|
+
> 使用 `pnpm` 替代 `npm` 可以显著提高依赖安装速度并节省磁盘空间。
|
|
41
|
+
|
|
42
|
+
### 安全提醒
|
|
43
|
+
|
|
44
|
+
> [!IMPORTANT]
|
|
45
|
+
> 永远不要将 API 密钥或敏感信息提交到公开的代码仓库中。
|
|
46
|
+
|
|
47
|
+
### 废弃警告
|
|
48
|
+
|
|
49
|
+
> [!WARNING]
|
|
50
|
+
> `v1.0.0` 版本中的 `oldFunction()` 方法将在下个版本中移除,请迁移到 `newFunction()`。
|
|
51
|
+
|
|
52
|
+
### 危险操作
|
|
53
|
+
|
|
54
|
+
> [!CAUTION]
|
|
55
|
+
> 执行 `rm -rf /` 将删除所有文件,这是一个不可逆的操作,请谨慎使用!
|
|
56
|
+
|
|
57
|
+
## 组合使用
|
|
58
|
+
|
|
59
|
+
在编写文档时,可以根据信息的严重程度选择合适的提示框类型:
|
|
60
|
+
|
|
61
|
+
> [!NOTE]
|
|
62
|
+
> 本项目需要 Node.js 18+ 版本。
|
|
63
|
+
|
|
64
|
+
> [!TIP]
|
|
65
|
+
> 推荐使用 `nvm` 管理 Node.js 版本。
|
|
66
|
+
|
|
67
|
+
> [!IMPORTANT]
|
|
68
|
+
> 在生产环境中,请确保设置 `NODE_ENV=production`。
|
|
69
|
+
|
|
70
|
+
> [!WARNING]
|
|
71
|
+
> 不要在生产环境中使用开发依赖。
|
|
72
|
+
|
|
73
|
+
> [!CAUTION]
|
|
74
|
+
> 修改数据库结构前请务必备份数据!
|
|
75
|
+
|
|
76
|
+
## 与其他 Markdown 元素组合
|
|
77
|
+
|
|
78
|
+
> [!TIP]
|
|
79
|
+
> 你可以在提示框中使用 **加粗**、*斜体*、`代码` 等 Markdown 格式。
|
|
80
|
+
>
|
|
81
|
+
> 甚至可以添加列表:
|
|
82
|
+
> - 第一项
|
|
83
|
+
> - 第二项
|
|
84
|
+
> - 第三项
|
|
85
|
+
|
|
86
|
+
GitHub Alerts 让文档更加清晰易读!
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "代码高亮示例"
|
|
3
|
+
description: "展示 Shiki 代码高亮功能,支持多种编程语言和高级特性"
|
|
4
|
+
pubDatetime: 2024-01-05T00:00:00.000Z
|
|
5
|
+
tags:
|
|
6
|
+
- 教程
|
|
7
|
+
- 代码
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## 基础代码块
|
|
11
|
+
|
|
12
|
+
### TypeScript
|
|
13
|
+
|
|
14
|
+
```typescript
|
|
15
|
+
interface User {
|
|
16
|
+
id: number;
|
|
17
|
+
name: string;
|
|
18
|
+
email: string;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
async function fetchUser(id: number): Promise<User> {
|
|
22
|
+
const response = await fetch(`/api/users/${id}`);
|
|
23
|
+
if (!response.ok) {
|
|
24
|
+
throw new Error('Failed to fetch user');
|
|
25
|
+
}
|
|
26
|
+
return response.json();
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// 使用示例
|
|
30
|
+
const user = await fetchUser(1);
|
|
31
|
+
console.log(`Hello, ${user.name}!`);
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### Python
|
|
35
|
+
|
|
36
|
+
```python
|
|
37
|
+
from typing import List, Optional
|
|
38
|
+
|
|
39
|
+
class Calculator:
|
|
40
|
+
"""一个简单的计算器类"""
|
|
41
|
+
|
|
42
|
+
def __init__(self, initial_value: float = 0):
|
|
43
|
+
self.value = initial_value
|
|
44
|
+
|
|
45
|
+
def add(self, x: float) -> 'Calculator':
|
|
46
|
+
self.value += x
|
|
47
|
+
return self
|
|
48
|
+
|
|
49
|
+
def multiply(self, x: float) -> 'Calculator':
|
|
50
|
+
self.value *= x
|
|
51
|
+
return self
|
|
52
|
+
|
|
53
|
+
# 链式调用
|
|
54
|
+
result = Calculator(10).add(5).multiply(2).value
|
|
55
|
+
print(f"Result: {result}") # Result: 30.0
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Rust
|
|
59
|
+
|
|
60
|
+
```rust
|
|
61
|
+
use std::collections::HashMap;
|
|
62
|
+
|
|
63
|
+
fn main() {
|
|
64
|
+
let mut scores = HashMap::new();
|
|
65
|
+
|
|
66
|
+
scores.insert("Alice", 95);
|
|
67
|
+
scores.insert("Bob", 87);
|
|
68
|
+
scores.insert("Charlie", 92);
|
|
69
|
+
|
|
70
|
+
for (name, score) in &scores {
|
|
71
|
+
println!("{}: {}", name, score);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## 高级特性
|
|
77
|
+
|
|
78
|
+
### 代码标题
|
|
79
|
+
|
|
80
|
+
```typescript title="utils/date.ts"
|
|
81
|
+
export function formatDate(date: Date): string {
|
|
82
|
+
return new Intl.DateTimeFormat('zh-CN', {
|
|
83
|
+
year: 'numeric',
|
|
84
|
+
month: 'long',
|
|
85
|
+
day: 'numeric',
|
|
86
|
+
}).format(date);
|
|
87
|
+
}
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### 行号显示
|
|
91
|
+
|
|
92
|
+
```typescript showLineNumbers
|
|
93
|
+
function fibonacci(n: number): number {
|
|
94
|
+
if (n <= 1) return n;
|
|
95
|
+
return fibonacci(n - 1) + fibonacci(n - 2);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// 计算前 10 个斐波那契数
|
|
99
|
+
for (let i = 0; i < 10; i++) {
|
|
100
|
+
console.log(fibonacci(i));
|
|
101
|
+
}
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### 代码差异高亮
|
|
105
|
+
|
|
106
|
+
```diff
|
|
107
|
+
function calculateTotal(items: CartItem[]): number {
|
|
108
|
+
- return items.reduce((sum, item) => sum + item.price, 0);
|
|
109
|
+
+ return items.reduce((sum, item) => sum + item.price * item.quantity, 0);
|
|
110
|
+
}
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### 行高亮
|
|
114
|
+
|
|
115
|
+
```typescript {2,5-7}
|
|
116
|
+
function processUser(user: User) {
|
|
117
|
+
const validated = validateUser(user); // 高亮
|
|
118
|
+
if (!validated) {
|
|
119
|
+
throw new Error('Invalid user');
|
|
120
|
+
}
|
|
121
|
+
saveToDatabase(user); // 高亮
|
|
122
|
+
sendNotification(user); // 高亮
|
|
123
|
+
return user;
|
|
124
|
+
}
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### 复制按钮
|
|
128
|
+
|
|
129
|
+
所有代码块都支持一键复制功能,点击右上角的复制按钮即可。
|
|
130
|
+
|
|
131
|
+
## 更多语言示例
|
|
132
|
+
|
|
133
|
+
### Go
|
|
134
|
+
|
|
135
|
+
```go
|
|
136
|
+
package main
|
|
137
|
+
|
|
138
|
+
import "fmt"
|
|
139
|
+
|
|
140
|
+
func main() {
|
|
141
|
+
messages := make(chan string)
|
|
142
|
+
|
|
143
|
+
go func() {
|
|
144
|
+
messages <- "Hello, World!"
|
|
145
|
+
}()
|
|
146
|
+
|
|
147
|
+
msg := <-messages
|
|
148
|
+
fmt.Println(msg)
|
|
149
|
+
}
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
### SQL
|
|
153
|
+
|
|
154
|
+
```sql
|
|
155
|
+
SELECT
|
|
156
|
+
u.name,
|
|
157
|
+
COUNT(o.id) as order_count,
|
|
158
|
+
SUM(o.total) as total_spent
|
|
159
|
+
FROM users u
|
|
160
|
+
LEFT JOIN orders o ON u.id = o.user_id
|
|
161
|
+
WHERE u.created_at > '2024-01-01'
|
|
162
|
+
GROUP BY u.id
|
|
163
|
+
HAVING total_spent > 1000
|
|
164
|
+
ORDER BY total_spent DESC
|
|
165
|
+
LIMIT 10;
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
代码高亮使用 [Shiki](https://shiki.matsu.io/) 引擎,支持数百种编程语言!
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Markmap 思维导图示例"
|
|
3
|
+
description: "展示 Markmap 交互式思维导图功能"
|
|
4
|
+
pubDatetime: 2024-01-03T00:00:00.000Z
|
|
5
|
+
tags:
|
|
6
|
+
- 教程
|
|
7
|
+
- Markmap
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## 什么是 Markmap?
|
|
11
|
+
|
|
12
|
+
Markmap 是一种将 Markdown 转换为交互式思维导图的工具,非常适合展示层次结构的内容。
|
|
13
|
+
|
|
14
|
+
## 基础用法
|
|
15
|
+
|
|
16
|
+
```markmap
|
|
17
|
+
# 中心主题
|
|
18
|
+
|
|
19
|
+
## 分支 1
|
|
20
|
+
### 子分支 1-1
|
|
21
|
+
### 子分支 1-2
|
|
22
|
+
#### 更深层级
|
|
23
|
+
|
|
24
|
+
## 分支 2
|
|
25
|
+
### 子分支 2-1
|
|
26
|
+
### 子分支 2-2
|
|
27
|
+
|
|
28
|
+
## 分支 3
|
|
29
|
+
### 子分支 3-1
|
|
30
|
+
### 子分支 3-2
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## 学习路线示例
|
|
34
|
+
|
|
35
|
+
```markmap
|
|
36
|
+
# 前端学习路线
|
|
37
|
+
|
|
38
|
+
## 基础知识
|
|
39
|
+
### HTML
|
|
40
|
+
### CSS
|
|
41
|
+
- Flexbox
|
|
42
|
+
- Grid
|
|
43
|
+
- 动画
|
|
44
|
+
### JavaScript
|
|
45
|
+
- ES6+
|
|
46
|
+
- DOM 操作
|
|
47
|
+
- 异步编程
|
|
48
|
+
|
|
49
|
+
## 框架
|
|
50
|
+
### React
|
|
51
|
+
- Hooks
|
|
52
|
+
- Redux
|
|
53
|
+
- Next.js
|
|
54
|
+
### Vue
|
|
55
|
+
- Composition API
|
|
56
|
+
- Pinia
|
|
57
|
+
- Nuxt
|
|
58
|
+
|
|
59
|
+
## 工具链
|
|
60
|
+
### 构建工具
|
|
61
|
+
- Vite
|
|
62
|
+
- Webpack
|
|
63
|
+
### 代码质量
|
|
64
|
+
- ESLint
|
|
65
|
+
- Prettier
|
|
66
|
+
- TypeScript
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## 项目架构示例
|
|
70
|
+
|
|
71
|
+
```markmap
|
|
72
|
+
# 项目架构
|
|
73
|
+
|
|
74
|
+
## 前端
|
|
75
|
+
### 页面组件
|
|
76
|
+
- 首页
|
|
77
|
+
- 列表页
|
|
78
|
+
- 详情页
|
|
79
|
+
### 公共组件
|
|
80
|
+
- Header
|
|
81
|
+
- Footer
|
|
82
|
+
- Modal
|
|
83
|
+
### 状态管理
|
|
84
|
+
- Store
|
|
85
|
+
- Actions
|
|
86
|
+
|
|
87
|
+
## 后端
|
|
88
|
+
### API 接口
|
|
89
|
+
- 用户相关
|
|
90
|
+
- 内容相关
|
|
91
|
+
### 数据库
|
|
92
|
+
- MySQL
|
|
93
|
+
- Redis
|
|
94
|
+
|
|
95
|
+
## 部署
|
|
96
|
+
### CI/CD
|
|
97
|
+
- GitHub Actions
|
|
98
|
+
### 服务器
|
|
99
|
+
- Nginx
|
|
100
|
+
- Docker
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
点击思维导图的节点可以展开或折叠子节点,非常适合做知识总结和项目规划!
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "数学公式示例"
|
|
3
|
+
description: "展示 KaTeX 数学公式渲染功能,支持行内公式和块级公式"
|
|
4
|
+
pubDatetime: 2024-01-04T00:00:00.000Z
|
|
5
|
+
tags:
|
|
6
|
+
- 教程
|
|
7
|
+
- 数学
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## 行内公式
|
|
11
|
+
|
|
12
|
+
这是一个简单的行内公式 $E = mc^2$,爱因斯坦的质能方程。
|
|
13
|
+
|
|
14
|
+
勾股定理:直角三角形的两条直角边的平方和等于斜边的平方,即 $a^2 + b^2 = c^2$。
|
|
15
|
+
|
|
16
|
+
## 块级公式
|
|
17
|
+
|
|
18
|
+
### 二次方程求根公式
|
|
19
|
+
|
|
20
|
+
$$x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}$$
|
|
21
|
+
|
|
22
|
+
### 欧拉公式
|
|
23
|
+
|
|
24
|
+
$$e^{i\pi} + 1 = 0$$
|
|
25
|
+
|
|
26
|
+
### 高斯积分
|
|
27
|
+
|
|
28
|
+
$$\int_{-\infty}^{\infty} e^{-x^2} dx = \sqrt{\pi}$$
|
|
29
|
+
|
|
30
|
+
### 泰勒展开
|
|
31
|
+
|
|
32
|
+
$$f(x) = \sum_{n=0}^{\infty} \frac{f^{(n)}(a)}{n!}(x-a)^n$$
|
|
33
|
+
|
|
34
|
+
### 矩阵
|
|
35
|
+
|
|
36
|
+
$$
|
|
37
|
+
\begin{bmatrix}
|
|
38
|
+
1 & 2 & 3 \\
|
|
39
|
+
4 & 5 & 6 \\
|
|
40
|
+
7 & 8 & 9
|
|
41
|
+
\end{bmatrix}
|
|
42
|
+
$$
|
|
43
|
+
|
|
44
|
+
### 分段函数
|
|
45
|
+
|
|
46
|
+
$$
|
|
47
|
+
f(x) = \begin{cases}
|
|
48
|
+
x^2, & x \geq 0 \\
|
|
49
|
+
-x^2, & x < 0
|
|
50
|
+
\end{cases}
|
|
51
|
+
$$
|
|
52
|
+
|
|
53
|
+
### 麦克斯韦方程组
|
|
54
|
+
|
|
55
|
+
$$
|
|
56
|
+
\nabla \cdot \mathbf{E} = \frac{\rho}{\varepsilon_0}
|
|
57
|
+
$$
|
|
58
|
+
|
|
59
|
+
$$
|
|
60
|
+
\nabla \cdot \mathbf{B} = 0
|
|
61
|
+
$$
|
|
62
|
+
|
|
63
|
+
$$
|
|
64
|
+
\nabla \times \mathbf{E} = -\frac{\partial \mathbf{B}}{\partial t}
|
|
65
|
+
$$
|
|
66
|
+
|
|
67
|
+
$$
|
|
68
|
+
\nabla \times \mathbf{B} = \mu_0 \mathbf{J} + \mu_0 \varepsilon_0 \frac{\partial \mathbf{E}}{\partial t}
|
|
69
|
+
$$
|
|
70
|
+
|
|
71
|
+
## 复杂公式示例
|
|
72
|
+
|
|
73
|
+
### 傅里叶变换
|
|
74
|
+
|
|
75
|
+
$$\hat{f}(\xi) = \int_{-\infty}^{\infty} f(x) e^{-2\pi i x \xi} dx$$
|
|
76
|
+
|
|
77
|
+
### 薛定谔方程
|
|
78
|
+
|
|
79
|
+
$$i\hbar \frac{\partial}{\partial t} \Psi(\mathbf{r}, t) = \hat{H} \Psi(\mathbf{r}, t)$$
|
|
80
|
+
|
|
81
|
+
数学公式使用 [KaTeX](https://katex.org/) 渲染,支持绝大多数 LaTeX 语法。
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Mermaid 图表示例"
|
|
3
|
+
description: "展示 Mermaid 流程图、时序图、饼图等多种图表功能"
|
|
4
|
+
pubDatetime: 2024-01-02T00:00:00.000Z
|
|
5
|
+
tags:
|
|
6
|
+
- 教程
|
|
7
|
+
- Mermaid
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## 流程图
|
|
11
|
+
|
|
12
|
+
```mermaid
|
|
13
|
+
graph TD
|
|
14
|
+
A[开始] --> B{是否登录?}
|
|
15
|
+
B -->|是| C[进入主页]
|
|
16
|
+
B -->|否| D[跳转登录页]
|
|
17
|
+
D --> E[输入用户名密码]
|
|
18
|
+
E --> F{验证成功?}
|
|
19
|
+
F -->|是| C
|
|
20
|
+
F -->|否| G[显示错误]
|
|
21
|
+
G --> E
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## 时序图
|
|
25
|
+
|
|
26
|
+
```mermaid
|
|
27
|
+
sequenceDiagram
|
|
28
|
+
participant 用户
|
|
29
|
+
participant 前端
|
|
30
|
+
participant 后端
|
|
31
|
+
participant 数据库
|
|
32
|
+
|
|
33
|
+
用户->>前端: 点击登录
|
|
34
|
+
前端->>后端: POST /api/login
|
|
35
|
+
后端->>数据库: 查询用户信息
|
|
36
|
+
数据库-->>后端: 返回用户数据
|
|
37
|
+
后端-->>前端: 返回 JWT Token
|
|
38
|
+
前端-->>用户: 跳转到主页
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## 饼图
|
|
42
|
+
|
|
43
|
+
```mermaid
|
|
44
|
+
pie showData
|
|
45
|
+
title 编程语言使用比例
|
|
46
|
+
"TypeScript" : 40
|
|
47
|
+
"Python" : 25
|
|
48
|
+
"Go" : 20
|
|
49
|
+
"Rust" : 15
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## 甘特图
|
|
53
|
+
|
|
54
|
+
```mermaid
|
|
55
|
+
gantt
|
|
56
|
+
title 项目开发计划
|
|
57
|
+
dateFormat YYYY-MM-DD
|
|
58
|
+
section 设计阶段
|
|
59
|
+
需求分析 :a1, 2024-01-01, 7d
|
|
60
|
+
UI设计 :a2, after a1, 5d
|
|
61
|
+
section 开发阶段
|
|
62
|
+
前端开发 :b1, after a2, 14d
|
|
63
|
+
后端开发 :b2, after a2, 14d
|
|
64
|
+
section 测试阶段
|
|
65
|
+
功能测试 :c1, after b1, 7d
|
|
66
|
+
上线部署 :c2, after c1, 3d
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## 状态图
|
|
70
|
+
|
|
71
|
+
```mermaid
|
|
72
|
+
stateDiagram-v2
|
|
73
|
+
[*] --> 草稿
|
|
74
|
+
草稿 --> 待审核: 提交
|
|
75
|
+
待审核 --> 已发布: 审核通过
|
|
76
|
+
待审核 --> 草稿: 审核拒绝
|
|
77
|
+
已发布 --> 已下架: 下架
|
|
78
|
+
已下架 --> 已发布: 重新发布
|
|
79
|
+
已发布 --> [*]
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
更多 Mermaid 图表类型请参考 [Mermaid 官方文档](https://mermaid.js.org/)。
|