Skip to content

Commit 31c3376

Browse files
committed
feat(docs): create website documents using vitepress
1 parent b7ca8da commit 31c3376

30 files changed

+2302
-3
lines changed

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,8 @@ coverage
66

77
upload
88

9-
test/start/index.js
9+
test/dev/index.js
1010
test/server/index.js
11+
12+
docs/.vitepress/cache
13+
docs/.vitepress/dist

docs/.vitepress/config.ts

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
import { defineConfig } from 'vitepress'
2+
3+
// https://vitepress.dev/reference/site-config
4+
export default defineConfig({
5+
title: 'x-crawl',
6+
description: '灵活的 Node.js AI 辅助爬虫库',
7+
8+
cleanUrls: true,
9+
10+
head: [['link', { rel: 'icon', type: 'image/svg+xml', href: '/logo.svg' }]],
11+
12+
themeConfig: {
13+
// https://vitepress.dev/reference/default-theme-config
14+
logo: '/logo.svg',
15+
16+
search: {
17+
provider: 'local'
18+
},
19+
20+
socialLinks: [
21+
{ icon: 'github', link: 'https://github.com/coder-hxl/x-crawl' },
22+
{ icon: 'discord', link: 'https://discord.gg/SF7aaebg4E' }
23+
]
24+
},
25+
26+
locales: {
27+
root: {
28+
label: '简体中文',
29+
lang: 'cn',
30+
31+
themeConfig: {
32+
// https://vitepress.dev/reference/default-theme-config
33+
nav: [
34+
{ text: '指南', link: '/guide/index' },
35+
{ text: 'API', link: '/api/index' },
36+
{ text: '关于', link: '/about/index' }
37+
],
38+
39+
search: {
40+
provider: 'local'
41+
},
42+
43+
sidebar: {
44+
'/guide': [
45+
{
46+
text: '开始',
47+
items: [
48+
{ text: '简介', link: '/guide/index' },
49+
{ text: '快速上手', link: '/guide/quick-start' }
50+
]
51+
},
52+
{
53+
text: '基础',
54+
items: [
55+
{ text: '创建应用', link: '/guide/create-crawl-application' },
56+
{ text: '爬取页面', link: '/guide/crawl-page' },
57+
{ text: '爬取 HTML', link: '/guide/crawl-html' },
58+
{ text: '爬取接口', link: '/guide/crawl-data' },
59+
{ text: '爬取文件', link: '/guide/crawl-file' },
60+
{ text: '间隔时间', link: '/guide/interval' },
61+
{ text: '失败重试', link: '/guide/retry' },
62+
{ text: '轮换代理', link: '/guide/proxy' },
63+
{ text: '优先队列', link: '/guide/priority' },
64+
{ text: '终端信息', link: '/guide/reporters' },
65+
{ text: '关于结果', link: '/guide/results' },
66+
{ text: 'TypeScript', link: '/guide/typescript' }
67+
]
68+
},
69+
{
70+
text: 'AI 辅助',
71+
items: [
72+
{ text: '创建 AI 应用', link: '/guide/create-ai-application' },
73+
{ text: '创建 AI 应用', link: '/guide/create-ai-application' },
74+
{ text: '创建 AI 应用', link: '/guide/create-ai-application' },
75+
{ text: '创建 AI 应用', link: '/guide/create-ai-application' },
76+
{ text: '创建 AI 应用', link: '/guide/create-ai-application' }
77+
]
78+
},
79+
{
80+
text: '进阶',
81+
items: [
82+
{ text: '创建 AI 应用', link: '/guide/create-ai-application' },
83+
{ text: '创建 AI 应用', link: '/guide/create-ai-application' },
84+
{ text: '创建 AI 应用', link: '/guide/create-ai-application' }
85+
]
86+
}
87+
],
88+
'/api': [{ text: 'api', items: [] }],
89+
'/about': [{ text: 'about', items: [] }]
90+
},
91+
92+
footer: {
93+
message: '基于 MIT 许可发布',
94+
copyright: '版权所有 © 2024-present CoderHXL'
95+
}
96+
}
97+
},
98+
99+
en: { label: 'English', lang: 'en', link: '/en' }
100+
}
101+
})

docs/.vitepress/theme/custom.css

Whitespace-only changes.

docs/.vitepress/theme/index.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import DefaultTheme from 'vitepress/theme'
2+
3+
import './custom.css'
4+
import './style/vars.css'
5+
6+
export default DefaultTheme

docs/.vitepress/theme/style/vars.css

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
:root {
2+
--c-yellow: #feba07;
3+
--c-red: #7c1823;
4+
}
5+
6+
:root {
7+
--vp-home-hero-image-background-image: linear-gradient(180deg, var(--c-yellow) 60%, var(--c-red) 30%);
8+
--vp-home-hero-image-filter: blur(40px);
9+
--vp-c-brand-1: #c79925;
10+
--vp-c-brand-2: #feba07;
11+
}
12+

docs/about/index.md

Whitespace-only changes.

docs/api-examples.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
---
2+
outline: deep
3+
---
4+
5+
# Runtime API Examples
6+
7+
This page demonstrates usage of some of the runtime APIs provided by VitePress.
8+
9+
The main `useData()` API can be used to access site, theme, and page data for the current page. It works in both `.md` and `.vue` files:
10+
11+
```md
12+
<script setup>
13+
import { useData } from 'vitepress'
14+
15+
const { theme, page, frontmatter } = useData()
16+
</script>
17+
18+
## Results
19+
20+
### Theme Data
21+
<pre>{{ theme }}</pre>
22+
23+
### Page Data
24+
<pre>{{ page }}</pre>
25+
26+
### Page Frontmatter
27+
<pre>{{ frontmatter }}</pre>
28+
```
29+
30+
<script setup>
31+
import { useData } from 'vitepress'
32+
33+
const { site, theme, page, frontmatter } = useData()
34+
</script>
35+
36+
## Results
37+
38+
### Theme Data
39+
<pre>{{ theme }}</pre>
40+
41+
### Page Data
42+
<pre>{{ page }}</pre>
43+
44+
### Page Frontmatter
45+
<pre>{{ frontmatter }}</pre>
46+
47+
## More
48+
49+
Check out the documentation for the [full list of runtime APIs](https://vitepress.dev/reference/runtime-api#usedata).

docs/api/index.md

Whitespace-only changes.

docs/cn.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ x-crawl 是一个灵活的 Node.js AI 辅助爬虫库。强大的 AI 辅助功
1010

1111
- **🤖 AI 辅助** - 强大的 AI 辅助功能,使爬虫工作变得更加高效、智能和便捷。
1212
- **🖋️ 写法灵活** - 单个爬取 API 都适配多种配置,每种配置方式都各有千秋。
13-
- **⚙️ 多种用途** - 支持爬动态页面、静态页面、接口数据以及文件数据。
13+
- **⚙️ 功能丰富** - 支持爬动态页面、静态页面、接口数据以及文件数据。
1414
- **⚒️ 控制页面** - 爬取动态页面支持自动化操作、键盘输入、事件操作等。
1515
- **👀 设备指纹** - 零配置或自定义配置,避免指纹识别从不同位置识别并跟踪我们。
1616
- **🔥 异步同步** - 无需切换爬取 API 即可进行异步或同步的爬取模式。
1717
- **⏱️ 间隔爬取** - 无间隔、固定间隔以及随机间隔,决定是否高并发爬取。
1818
- **🔄 失败重试** - 自定义重试次数,避免因短暂的问题而造成爬取失败。
1919
- **➡️ 轮换代理** - 搭配失败重试,自定义错误次数以及 HTTP 状态码自动轮换代理。
2020
- **🚀 优先队列** - 根据单个爬取目标的优先级可以优先于其他目标提前爬取。
21-
- **🧾 爬取信息** - 可控的爬取信息,会在终端输出彩色字符串信息。
21+
- **🧾 记录爬取** - 可控的爬取信息,会在终端输出彩色字符串信息。
2222
- **🦾 TypeScript** - 拥有类型,通过泛型实现完整的类型。
2323

2424
## 赞助

docs/en/index.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
---
2+
# https://vitepress.dev/reference/default-theme-home-page
3+
layout: home
4+
5+
hero:
6+
name: 'x-crawl'
7+
text: 'Flexible Node.js AI-assisted crawler library'
8+
tagline: Making crawler work more efficient, intelligent and convenient
9+
actions:
10+
- theme: brand
11+
text: Get Started
12+
link: /markdown-examples
13+
- theme: alt
14+
text: View on GitHub
15+
link: https://github.com/coder-hxl/x-crawl
16+
17+
features:
18+
- icon: 🤖
19+
title: AI 辅助
20+
details: 强大的 AI 辅助功能,使爬虫工作变得更加高效、智能和便捷。
21+
- icon: 🖋️
22+
title: 写法灵活
23+
details: 单个爬取 API 都适配多种配置,每种配置方式都各有千秋。
24+
- icon: ⚙️
25+
title: 功能丰富
26+
details: 支持爬动态页面、静态页面、接口数据以及文件数据。
27+
- icon: ⚒️
28+
title: 控制页面
29+
details: 爬取动态页面支持自动化操作、键盘输入、事件操作等。
30+
- icon: 👀
31+
title: 设备指纹
32+
details: 零配置或自定义配置,避免指纹识别从不同位置识别并跟踪我们。
33+
- icon: 🔥
34+
title: 异步同步
35+
details: 无需切换爬取 API 即可进行异步或同步的爬取模式。
36+
- icon: ⏱️
37+
title: 间隔爬取
38+
details: 无间隔、固定间隔以及随机间隔,决定是否高并发爬取。
39+
- icon: 🔄
40+
title: 失败重试
41+
details: 自定义重试次数,避免因短暂的问题而造成爬取失败。
42+
- icon: ➡️
43+
title: 轮换代理
44+
details: 搭配失败重试,自定义错误次数以及 HTTP 状态码自动轮换代理。
45+
- icon: 🚀
46+
title: 优先队列
47+
details: 根据单个爬取目标的优先级可以优先于其他目标提前爬取。
48+
- icon: 🧾
49+
title: 记录爬取
50+
details: 可控的爬取信息,会在终端输出彩色字符串信息。
51+
- icon: 🦾
52+
title: TypeScrip
53+
details: 拥有类型,通过泛型实现完整的类型。
54+
---

0 commit comments

Comments
 (0)