Skip to content

Commit 2fe89f6

Browse files
init: Mp2RSS 产品介绍与 Open API 文档站点
- VitePress 2.0 alpha 搭建的静态站 - 首页 hero + features,介绍 Mp2RSS 的核心价值 - 指南:服务介绍、快速开始、订阅管理、会员与计费、服务条款、FAQ - API:Open API 列表(4 个端点完整参考) - 主题:复用 CopyPath 组件、自定义 hero 字号 - Bug 反馈:GitHub Issues / Discussions
0 parents  commit 2fe89f6

19 files changed

Lines changed: 2256 additions & 0 deletions

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
node_modules
2+
.vitepress/cache
3+
.vitepress/dist
4+
.DS_Store
5+
*.log

.vitepress/config.mts

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
import { defineConfig } from "vitepress";
2+
3+
const GOOGLE_ANALYTICS_ID = process.env.GOOGLE_ANALYTICS_ID || "";
4+
const gaHead = GOOGLE_ANALYTICS_ID
5+
? ([
6+
[
7+
"script",
8+
{
9+
async: "",
10+
src: `https://www.googletagmanager.com/gtag/js?id=${GOOGLE_ANALYTICS_ID}`,
11+
},
12+
],
13+
[
14+
"script",
15+
{},
16+
`
17+
window.dataLayer = window.dataLayer || [];
18+
function gtag(){dataLayer.push(arguments);}
19+
gtag('js', new Date());
20+
gtag('config', '${GOOGLE_ANALYTICS_ID}');
21+
`,
22+
],
23+
] as any)
24+
: [];
25+
26+
// https://vitepress.dev/reference/site-config
27+
export default defineConfig({
28+
srcDir: "docs",
29+
title: "Mp2RSS",
30+
description: "让订阅微信公众号像订阅播客一样顺畅",
31+
base: "/",
32+
lastUpdated: true,
33+
head: [
34+
["link", { rel: "icon", href: "/favicon.ico" }],
35+
["link", { rel: "apple-touch-icon", href: "/apple-touch-icon.png" }],
36+
...gaHead,
37+
],
38+
themeConfig: {
39+
logo: "/logo.png",
40+
nav: [
41+
{ text: "指南", link: "/guide/quick-start" },
42+
{ text: "API 列表", link: "/api/" },
43+
{ text: "FAQ", link: "/guide/faq" },
44+
],
45+
sidebar: {
46+
"/guide/": [
47+
{
48+
text: "服务说明",
49+
items: [
50+
{ text: "快速开始", link: "/guide/quick-start" },
51+
{ text: "服务介绍", link: "/guide/intro" },
52+
{ text: "订阅管理", link: "/guide/subscription" },
53+
{ text: "会员与计费", link: "/guide/membership" },
54+
{ text: "服务条款", link: "/guide/terms-of-service" },
55+
{ text: "FAQ", link: "/guide/faq" },
56+
],
57+
},
58+
{
59+
text: "反馈",
60+
items: [
61+
{
62+
text: "Bug 反馈",
63+
link: "https://github.com/areyoubugcoder/Mp2RSS/issues",
64+
},
65+
{
66+
text: "讨论区",
67+
link: "https://github.com/areyoubugcoder/Mp2RSS/discussions",
68+
},
69+
],
70+
},
71+
],
72+
"/api/": [
73+
{
74+
text: "API 说明",
75+
items: [{ text: "API 列表", link: "/api/" }],
76+
},
77+
{
78+
text: "反馈",
79+
items: [
80+
{
81+
text: "Bug 反馈",
82+
link: "https://github.com/areyoubugcoder/Mp2RSS/issues",
83+
},
84+
{
85+
text: "讨论区",
86+
link: "https://github.com/areyoubugcoder/Mp2RSS/discussions",
87+
},
88+
],
89+
},
90+
],
91+
},
92+
socialLinks: [
93+
{
94+
icon: "github",
95+
link: "https://github.com/areyoubugcoder/Mp2RSS",
96+
},
97+
],
98+
search: {
99+
provider: "local",
100+
},
101+
},
102+
});
Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
<template>
2+
<span class="copy-path-wrapper">
3+
<code class="path-text">{{ path }}</code>
4+
<button
5+
class="copy-btn"
6+
@click="copyToClipboard"
7+
:title="copied ? '已复制!' : '复制路径'"
8+
:class="{ 'copied': copied }"
9+
>
10+
<svg v-if="!copied" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
11+
<rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect>
12+
<path d="M5 15H4a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v1"></path>
13+
</svg>
14+
<svg v-else width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
15+
<polyline points="20,6 9,17 4,12"></polyline>
16+
</svg>
17+
</button>
18+
</span>
19+
</template>
20+
21+
<script setup lang="ts">
22+
import { ref } from 'vue'
23+
24+
interface Props {
25+
path: string
26+
}
27+
28+
const props = defineProps<Props>()
29+
const copied = ref(false)
30+
31+
const copyToClipboard = async () => {
32+
try {
33+
await navigator.clipboard.writeText(props.path)
34+
copied.value = true
35+
setTimeout(() => {
36+
copied.value = false
37+
}, 2000)
38+
} catch (err) {
39+
// 降级方案:使用传统的复制方法
40+
const textArea = document.createElement('textarea')
41+
textArea.value = props.path
42+
document.body.appendChild(textArea)
43+
textArea.select()
44+
document.execCommand('copy')
45+
document.body.removeChild(textArea)
46+
copied.value = true
47+
setTimeout(() => {
48+
copied.value = false
49+
}, 2000)
50+
}
51+
}
52+
</script>
53+
54+
<style scoped>
55+
.copy-path-wrapper {
56+
display: inline-flex;
57+
align-items: center;
58+
position: relative;
59+
}
60+
61+
.path-text {
62+
background: var(--vp-code-bg);
63+
padding: 0 6px;
64+
border-radius: 4px;
65+
font-family: var(--vp-font-family-mono);
66+
font-size: 0.875em;
67+
margin: 0;
68+
}
69+
70+
.copy-btn {
71+
background: transparent;
72+
border: none;
73+
cursor: pointer;
74+
padding: 4px;
75+
margin-left: 6px;
76+
border-radius: 4px;
77+
display: inline-flex;
78+
align-items: center;
79+
justify-content: center;
80+
color: var(--vp-c-text-2);
81+
transition: all 0.2s ease;
82+
opacity: 0.7;
83+
position: relative;
84+
min-width: 22px;
85+
min-height: 22px;
86+
}
87+
88+
.copy-btn:hover {
89+
background: var(--vp-c-default-soft);
90+
color: var(--vp-c-text-1);
91+
opacity: 1;
92+
}
93+
94+
.copy-btn:active {
95+
transform: scale(0.95);
96+
}
97+
98+
.copy-btn.copied {
99+
color: var(--vp-c-brand-1);
100+
opacity: 1;
101+
}
102+
103+
.copy-btn svg {
104+
width: 14px;
105+
height: 14px;
106+
flex-shrink: 0;
107+
}
108+
109+
/* 响应式设计 */
110+
@media (max-width: 768px) {
111+
.path-text {
112+
font-size: 0.8em;
113+
padding: 1px 4px;
114+
}
115+
116+
.copy-btn {
117+
padding: 3px;
118+
margin-left: 4px;
119+
min-width: 20px;
120+
min-height: 20px;
121+
}
122+
123+
.copy-btn svg {
124+
width: 12px;
125+
height: 12px;
126+
}
127+
}
128+
</style>

.vitepress/theme/custom.css

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/* 调整首页 tagline/description 字体大小 */
2+
.VPHero .tagline {
3+
font-size: 48px !important;
4+
}
5+
6+
/* 如果是 text 字段也需要调整 */
7+
.VPHero .text {
8+
font-size: 48px !important;
9+
}

.vitepress/theme/index.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import DefaultTheme from "vitepress/theme";
2+
import "./custom.css";
3+
import CopyPath from "./components/CopyPath.vue";
4+
import type { App } from 'vue';
5+
6+
export default {
7+
...DefaultTheme,
8+
enhanceApp({ app }: { app: App }) {
9+
app.component('CopyPath', CopyPath)
10+
}
11+
};

README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Mp2RSS Docs
2+
3+
Mp2RSS 产品介绍与 Open API 文档站点,基于 [VitePress](https://vitepress.dev/) 构建。
4+
5+
## 本地开发
6+
7+
```bash
8+
pnpm install
9+
pnpm dev # http://localhost:5173
10+
pnpm build # 产物输出到 .vitepress/dist
11+
pnpm preview # 本地预览生产构建
12+
```
13+
14+
## 目录
15+
16+
- `docs/` —— 站点内容源文件
17+
- `index.md` —— 首页
18+
- `guide/` —— 使用指南
19+
- `api/` —— Open API 参考
20+
- `public/` —— 静态资源(favicon / logo)
21+
- `.vitepress/` —— VitePress 配置与主题定制
22+
- `config.mts` —— 站点配置(nav / sidebar / search)
23+
- `theme/` —— 主题增强(`CopyPath` 组件、自定义样式)

0 commit comments

Comments
 (0)