update init

This commit is contained in:
mei 2025-01-01 15:49:01 +08:00
parent 9adb778230
commit 5cccd2c0e6
12 changed files with 4731 additions and 0 deletions

3
.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
/docs/.vitepress/dist
/docs/.vitepress/cache
/node_modules

View File

@ -0,0 +1,37 @@
import { defineConfig } from 'vitepress';
import { generateSidebar } from "vitepress-sidebar";
const vitepressSidebarOptions = {
documentRootPath: "/docs/src",
collapsed: false, //折叠组关闭
collapseDepth: 2, //折叠组2级菜单
removePrefixAfterOrdering: true, //删除前缀必须与prefixSeparator一起使用
prefixSeparator: "_", //删除前缀的符号
};
// https://vitepress.dev/reference/site-config
export default defineConfig({
lastUpdated: true,
lang: 'zh-CN',
title: "杂乱的收获",
description: "杂乱的收获,不想失去",
srcDir: './src',
themeConfig: {
editLink: {
pattern: 'https://git.mei.lv/mei/kb/edit/main/docs/:path'
},
search: {
provider: 'local'
},
sidebar: generateSidebar(vitepressSidebarOptions),
// https://vitepress.dev/reference/default-theme-config
nav: [
{ text: 'Home', link: '/' },
{ text: 'Examples', link: '/markdown-examples' }
],
socialLinks: [
{ icon: 'github', link: 'https://git.mei.lv/mei/kb' }
]
}
})

View File

@ -0,0 +1,22 @@
import DefaultTheme from "vitepress/theme";
import "./style/index.css";
import mediumZoom from 'medium-zoom';
import { onMounted, watch, nextTick } from 'vue';
import { useRoute } from 'vitepress';
export default {
extends: DefaultTheme,
setup() {
const route = useRoute();
const initZoom = () => {
// mediumZoom('[data-zoomable]', { background: 'var(--vp-c-bg)' }); // 默认
mediumZoom(".main img", { background: "var(--vp-c-bg)" }); // 不显式添加{data-zoomable}的情况下为所有图像启用此功能
};
onMounted(() => {
initZoom();
});
watch(
() => route.path,
() => nextTick(() => initZoom())
);
},
};

View File

@ -0,0 +1,73 @@
/* .vitepress/theme/style/blur.css */
:root {
/* 首页导航 */
.VPNavBar {
background-color: rgba(255, 255, 255, 0);
backdrop-filter: blur(10px);
}
/* 文档页导航两侧 */
.VPNavBar:not(.home) {
background-color: rgba(255, 255, 255, 0);
backdrop-filter: blur(10px);
}
@media (min-width: 960px) {
/* 文档页导航两侧 */
.VPNavBar:not(.home) {
background-color: rgba(255, 255, 255, 0);
backdrop-filter: blur(10px);
}
/* 首页下滑后导航两侧 */
.VPNavBar:not(.has-sidebar):not(.home.top) {
background-color: rgba(255, 255, 255, 0);
backdrop-filter: blur(10px);
}
}
@media (min-width: 960px) {
/* 文档页导航中间 */
.VPNavBar:not(.home.top) .content-body {
background-color: rgba(255, 255, 255, 0);
backdrop-filter: blur(10px);
}
/* 首页下滑后导航中间 */
.VPNavBar:not(.has-sidebar):not(.home.top) .content-body {
background-color: rgba(255, 255, 255, 0);
backdrop-filter: blur(10px);
}
}
/* 分割线 */
@media (min-width: 960px) {
/* 文档页分割线 */
.VPNavBar:not(.home.top) .divider-line {
background-color: rgba(255, 255, 255, 0);
backdrop-filter: blur(10px);
}
/* 首页分割线 */
.VPNavBar:not(.has-sidebar):not(.home.top) .divider {
background-color: rgba(255, 255, 255, 0);
backdrop-filter: blur(10px);
}
}
/* 搜索框 VPNavBarSearchButton.vue */
.DocSearch-Button {
background-color: rgba(255, 255, 255, 0);
backdrop-filter: blur(10px);
}
/* 移动端大纲栏 */
.VPLocalNav {
background-color: rgba(255, 255, 255, 0);
backdrop-filter: blur(10px);
/* 隐藏分割线 */
/* border-bottom: 5px solid var(--vp-c-gutter); */
border-bottom: 0px;
}
}

View File

@ -0,0 +1,3 @@
/* index.css */
@import "./var.css";
@import "./blur.css";

View File

@ -0,0 +1,50 @@
/* var.css */
:root {
--vp-c-brand-1: #18794e;
--vp-c-brand-2: #299764;
--vp-c-brand-3: #30a46c;
}
.dark {
--vp-c-brand-1: #3dd68c;
--vp-c-brand-2: #30a46c;
--vp-c-brand-3: #298459;
}
/* 以前的vp-c-brand已弃用 */
:root {
/* hero标题渐变色 */
--vp-home-hero-name-color: transparent;
--vp-home-hero-name-background: -webkit-linear-gradient(120deg,
#bd34fe,
#41d1ff);
/*hero logo背景渐变色 */
--vp-home-hero-image-background-image: linear-gradient(-45deg,
#bd34fe 50%,
#47caff 50%);
--vp-home-hero-image-filter: blur(40px);
}
/* 也可自行单独修改brand按钮 */
/* :root {
--vp-button-brand-border: #F6CEEC;
--vp-button-brand-text: #F6CEEC;
--vp-button-brand-bg: #D939CD;
--vp-button-brand-hover-border: #F6CEEC;
--vp-button-brand-hover-text: #fff;
--vp-button-brand-hover-bg: #D939CD;
--vp-button-brand-active-border: #F6CEEC;
} */
/* .vitepress/theme/style/var.css */
.medium-zoom-overlay {
z-index: 30;
}
.medium-zoom-image {
z-index: 9999 !important;
/* 给的值是21但是实测盖不住直接999 */
}

View File

@ -0,0 +1,49 @@
---
outline: deep
---
# 运行时 API 示例
本页演示了 VitePress 提供的一些运行时 API 的使用。
主要的 'useData' API 可用于访问当前页面的站点、主题和页面数据。它适用于 '.md' 和 '.vue' 文件:
```md
<script setup>
import { useData } from 'vitepress'
const { theme, page, frontmatter } = useData()
</script>
## Results
### Theme Data
<pre>{{ theme }}</pre>
### Page Data
<pre>{{ page }}</pre>
### Page Frontmatter
<pre>{{ frontmatter }}</pre>
```
<script setup>
import { useData } from 'vitepress'
const { site, theme, page, frontmatter } = useData()
</script>
## Results
### Theme Data
<pre>{{ theme }}</pre>
### Page Data
<pre>{{ page }}</pre>
### Page Frontmatter
<pre>{{ frontmatter }}</pre>
## More
查看 [运行时 API 的完整列表](https://vitepress.dev/reference/runtime-api#usedata) 的文档。

View File

@ -0,0 +1,85 @@
# Markdown 扩展示例
本页演示了 VitePress 提供的一些内置 markdown 扩展。
## 语法高亮
VitePress 提供由 [Shiki]https://github.com/shikijs/shiki 提供支持的语法高亮,以及行高亮等附加功能:
**Input**
````md
```js{4}
export default {
data () {
return {
msg: 'Highlighted!'
}
}
}
```
````
**Output**
```js{4}
export default {
data () {
return {
msg: 'Highlighted!'
}
}
}
```
## Custom Containers
**Input**
```md
::: info
This is an info box.
:::
::: tip
This is a tip.
:::
::: warning
This is a warning.
:::
::: danger
This is a dangerous warning.
:::
::: details
This is a details block.
:::
```
**Output**
::: info
This is an info box.
:::
::: tip
This is a tip.
:::
::: warning
This is a warning.
:::
::: danger
This is a dangerous warning.
:::
::: details
This is a details block.
:::
## More
Check out the documentation for the [full list of markdown extensions](https://vitepress.dev/guide/markdown).

25
docs/src/index.md Normal file
View File

@ -0,0 +1,25 @@
---
# https://vitepress.dev/reference/default-theme-home-page
layout: home
hero:
name: "杂乱的收获"
text: "你想看看吗"
tagline: My best project
actions:
- theme: brand
text: 开始阅读
link: /example/markdown-examples
- theme: alt
text: API Examples
link: /example/api-examples
features:
- title: Feature A
details: Lorem ipsum dolor sit amet, consectetur adipiscing elit
- title: Feature B
details: Lorem ipsum dolor sit amet, consectetur adipiscing elit
- title: Feature C
details: Lorem ipsum dolor sit amet, consectetur adipiscing elit
---

2462
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

12
package.json Normal file
View File

@ -0,0 +1,12 @@
{
"devDependencies": {
"medium-zoom": "^1.1.0",
"vitepress": "^1.5.0",
"vitepress-sidebar": "^1.30.2"
},
"scripts": {
"docs:dev": "vitepress dev docs",
"docs:build": "vitepress build docs",
"docs:preview": "vitepress preview docs"
}
}

1910
pnpm-lock.yaml Normal file

File diff suppressed because it is too large Load Diff