feat: 自定义vitepress主题demo

main
ppst 1 year ago
commit 7ff40d80ff

6
.gitignore vendored

@ -0,0 +1,6 @@
/coverage
/node_modules
dist
TODOs.md
.DS_Store
demo/.vitepress/cache

@ -0,0 +1,23 @@
{
"hash": "ae1feb48",
"browserHash": "e0d66d6a",
"optimized": {
"vue": {
"src": "../../../node_modules/.pnpm/vue@3.3.4/node_modules/vue/dist/vue.runtime.esm-bundler.js",
"file": "vue.js",
"fileHash": "8fc6d2ae",
"needsInterop": false
},
"ppst-vitepress-theme": {
"src": "../../../node_modules/.pnpm/ppst-vitepress-theme@0.0.2_vitepress@1.0.0-alpha.64/node_modules/ppst-vitepress-theme/src/index.ts",
"file": "ppst-vitepress-theme.js",
"fileHash": "2f2eb96a",
"needsInterop": false
}
},
"chunks": {
"chunk-WICYTZ2N": {
"file": "chunk-WICYTZ2N.js"
}
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

@ -0,0 +1,3 @@
{
"type": "module"
}

@ -0,0 +1,49 @@
import {
defineComponent,
h,
provide
} from "./chunk-WICYTZ2N.js";
// node_modules/.pnpm/ppst-vitepress-theme@0.0.2_vitepress@1.0.0-alpha.64/node_modules/ppst-vitepress-theme/src/vitepress/index.ts
import "D:/pengpian/git/custom-vitepress-theme-demo/node_modules/.pnpm/normalize.css@8.0.1/node_modules/normalize.css/normalize.css";
import "D:/pengpian/git/custom-vitepress-theme-demo/node_modules/.pnpm/ppst-vitepress-theme@0.0.2_vitepress@1.0.0-alpha.64/node_modules/ppst-vitepress-theme/src/vitepress/styles/variables.css";
import "D:/pengpian/git/custom-vitepress-theme-demo/node_modules/.pnpm/ppst-vitepress-theme@0.0.2_vitepress@1.0.0-alpha.64/node_modules/ppst-vitepress-theme/src/vitepress/styles/switch.css";
import "D:/pengpian/git/custom-vitepress-theme-demo/node_modules/.pnpm/ppst-vitepress-theme@0.0.2_vitepress@1.0.0-alpha.64/node_modules/ppst-vitepress-theme/src/vitepress/styles/custom.css";
import "D:/pengpian/git/custom-vitepress-theme-demo/node_modules/.pnpm/ppst-vitepress-theme@0.0.2_vitepress@1.0.0-alpha.64/node_modules/ppst-vitepress-theme/src/vitepress/styles/theme.css";
import Layout from "D:/pengpian/git/custom-vitepress-theme-demo/node_modules/.pnpm/ppst-vitepress-theme@0.0.2_vitepress@1.0.0-alpha.64/node_modules/ppst-vitepress-theme/src/vitepress/components/Layout.vue";
import Search from "D:/pengpian/git/custom-vitepress-theme-demo/node_modules/.pnpm/ppst-vitepress-theme@0.0.2_vitepress@1.0.0-alpha.64/node_modules/ppst-vitepress-theme/src/vitepress/components/Search.vue";
import Archives from "D:/pengpian/git/custom-vitepress-theme-demo/node_modules/.pnpm/ppst-vitepress-theme@0.0.2_vitepress@1.0.0-alpha.64/node_modules/ppst-vitepress-theme/src/vitepress/components/Archives.vue";
import Home from "D:/pengpian/git/custom-vitepress-theme-demo/node_modules/.pnpm/ppst-vitepress-theme@0.0.2_vitepress@1.0.0-alpha.64/node_modules/ppst-vitepress-theme/src/vitepress/components/Home.vue";
import DefaultPage from "D:/pengpian/git/custom-vitepress-theme-demo/node_modules/.pnpm/ppst-vitepress-theme@0.0.2_vitepress@1.0.0-alpha.64/node_modules/ppst-vitepress-theme/src/vitepress/components/DefaultPage.vue";
import CategoryPage from "D:/pengpian/git/custom-vitepress-theme-demo/node_modules/.pnpm/ppst-vitepress-theme@0.0.2_vitepress@1.0.0-alpha.64/node_modules/ppst-vitepress-theme/src/vitepress/components/CategoryPage.vue";
// node_modules/.pnpm/ppst-vitepress-theme@0.0.2_vitepress@1.0.0-alpha.64/node_modules/ppst-vitepress-theme/src/vitepress/composables/config.ts
import { useData } from "vitepress";
var configSymbol = Symbol("config");
function withConfigProvider(App) {
return defineComponent({
name: "ConfigProvider",
setup(_, { slots }) {
const { theme } = useData();
provide(configSymbol, theme.value);
return () => h(App, null, slots);
}
});
}
// node_modules/.pnpm/ppst-vitepress-theme@0.0.2_vitepress@1.0.0-alpha.64/node_modules/ppst-vitepress-theme/src/vitepress/index.ts
var CustomTheme = {
Layout: withConfigProvider(Layout),
NotFound: () => "custom 404",
enhanceApp({ app }) {
app.component("Search", Search);
app.component("Archives", Archives);
app.component("Home", Home);
app.component("DefaultPage", DefaultPage);
app.component("CategoryPage", CategoryPage);
}
};
export {
CustomTheme
};
//# sourceMappingURL=ppst-vitepress-theme.js.map

@ -0,0 +1,7 @@
{
"version": 3,
"sources": ["../../../node_modules/.pnpm/ppst-vitepress-theme@0.0.2_vitepress@1.0.0-alpha.64/node_modules/ppst-vitepress-theme/src/vitepress/index.ts", "../../../node_modules/.pnpm/ppst-vitepress-theme@0.0.2_vitepress@1.0.0-alpha.64/node_modules/ppst-vitepress-theme/src/vitepress/composables/config.ts"],
"sourcesContent": ["import 'normalize.css/normalize.css'\nimport './styles/variables.css'\nimport './styles/switch.css'\nimport './styles/custom.css'\nimport './styles/theme.css'\nimport Layout from './components/Layout.vue'\nimport Search from './components/Search.vue'\nimport Archives from './components/Archives.vue'\nimport Home from './components/Home.vue'\nimport DefaultPage from './components/DefaultPage.vue'\nimport CategoryPage from './components/CategoryPage.vue'\nimport { Theme } from 'vitepress'\nimport { withConfigProvider } from './composables/config'\n\nconst CustomTheme: Theme = {\n Layout: withConfigProvider(Layout),\n NotFound: () => 'custom 404',\n enhanceApp({ app }) {\n app.component('Search', Search)\n app.component('Archives', Archives)\n app.component('Home', Home)\n app.component('DefaultPage', DefaultPage)\n app.component('CategoryPage', CategoryPage)\n }\n}\n\nexport { CustomTheme }\nexport type { Config } from './config'\n", "import {\n Component,\n defineComponent,\n h,\n inject,\n InjectionKey,\n provide,\n Ref\n} from 'vue'\nimport { useData } from 'vitepress'\nimport { Config } from '../config'\n\nconst configSymbol: InjectionKey<Ref<Config>> = Symbol('config')\nexport function withConfigProvider(App: Component) {\n return defineComponent({\n name: 'ConfigProvider',\n setup(_, { slots }) {\n const { theme } = useData()\n provide(configSymbol, theme.value)\n return () => h(App, null, slots)\n }\n })\n}\n\nexport function useConfig() {\n return {\n config: inject(configSymbol)!\n }\n}\n"],
"mappings": ";;;;;;;AAAA,OAAO;AACP,OAAO;AACP,OAAO;AACP,OAAO;AACP,OAAO;AACP,OAAO,YAAY;AACnB,OAAO,YAAY;AACnB,OAAO,cAAc;AACrB,OAAO,UAAU;AACjB,OAAO,iBAAiB;AACxB,OAAO,kBAAkB;;;ACDzB,SAAS,eAAe;AAGxB,IAAM,eAA0C,OAAO,QAAQ;AACxD,SAAS,mBAAmB,KAAgB;AACjD,SAAO,gBAAgB;AAAA,IACrB,MAAM;AAAA,IACN,MAAM,GAAG,EAAE,MAAM,GAAG;AAClB,YAAM,EAAE,MAAM,IAAI,QAAQ;AAC1B,cAAQ,cAAc,MAAM,KAAK;AACjC,aAAO,MAAM,EAAE,KAAK,MAAM,KAAK;AAAA,IACjC;AAAA,EACF,CAAC;AACH;;;ADRA,IAAM,cAAqB;AAAA,EACzB,QAAQ,mBAAmB,MAAM;AAAA,EACjC,UAAU,MAAM;AAAA,EAChB,WAAW,EAAE,IAAI,GAAG;AAClB,QAAI,UAAU,UAAU,MAAM;AAC9B,QAAI,UAAU,YAAY,QAAQ;AAClC,QAAI,UAAU,QAAQ,IAAI;AAC1B,QAAI,UAAU,eAAe,WAAW;AACxC,QAAI,UAAU,gBAAgB,YAAY;AAAA,EAC5C;AACF;",
"names": []
}

@ -0,0 +1,313 @@
import {
BaseTransition,
BaseTransitionPropsValidators,
Comment,
EffectScope,
Fragment,
KeepAlive,
ReactiveEffect,
Static,
Suspense,
Teleport,
Text,
Transition,
TransitionGroup,
VueElement,
assertNumber,
callWithAsyncErrorHandling,
callWithErrorHandling,
camelize,
capitalize,
cloneVNode,
compatUtils,
compile,
computed,
createApp,
createBaseVNode,
createBlock,
createCommentVNode,
createElementBlock,
createHydrationRenderer,
createPropsRestProxy,
createRenderer,
createSSRApp,
createSlots,
createStaticVNode,
createTextVNode,
createVNode,
customRef,
defineAsyncComponent,
defineComponent,
defineCustomElement,
defineEmits,
defineExpose,
defineModel,
defineOptions,
defineProps,
defineSSRCustomElement,
defineSlots,
devtools,
effect,
effectScope,
getCurrentInstance,
getCurrentScope,
getTransitionRawChildren,
guardReactiveProps,
h,
handleError,
hasInjectionContext,
hydrate,
initCustomFormatter,
initDirectivesForSSR,
inject,
isMemoSame,
isProxy,
isReactive,
isReadonly,
isRef,
isRuntimeOnly,
isShallow,
isVNode,
markRaw,
mergeDefaults,
mergeModels,
mergeProps,
nextTick,
normalizeClass,
normalizeProps,
normalizeStyle,
onActivated,
onBeforeMount,
onBeforeUnmount,
onBeforeUpdate,
onDeactivated,
onErrorCaptured,
onMounted,
onRenderTracked,
onRenderTriggered,
onScopeDispose,
onServerPrefetch,
onUnmounted,
onUpdated,
openBlock,
popScopeId,
provide,
proxyRefs,
pushScopeId,
queuePostFlushCb,
reactive,
readonly,
ref,
registerRuntimeCompiler,
render,
renderList,
renderSlot,
resolveComponent,
resolveDirective,
resolveDynamicComponent,
resolveFilter,
resolveTransitionHooks,
setBlockTracking,
setDevtoolsHook,
setTransitionHooks,
shallowReactive,
shallowReadonly,
shallowRef,
ssrContextKey,
ssrUtils,
stop,
toDisplayString,
toHandlerKey,
toHandlers,
toRaw,
toRef,
toRefs,
toValue,
transformVNodeArgs,
triggerRef,
unref,
useAttrs,
useCssModule,
useCssVars,
useModel,
useSSRContext,
useSlots,
useTransitionState,
vModelCheckbox,
vModelDynamic,
vModelRadio,
vModelSelect,
vModelText,
vShow,
version,
warn,
watch,
watchEffect,
watchPostEffect,
watchSyncEffect,
withAsyncContext,
withCtx,
withDefaults,
withDirectives,
withKeys,
withMemo,
withModifiers,
withScopeId
} from "./chunk-WICYTZ2N.js";
export {
BaseTransition,
BaseTransitionPropsValidators,
Comment,
EffectScope,
Fragment,
KeepAlive,
ReactiveEffect,
Static,
Suspense,
Teleport,
Text,
Transition,
TransitionGroup,
VueElement,
assertNumber,
callWithAsyncErrorHandling,
callWithErrorHandling,
camelize,
capitalize,
cloneVNode,
compatUtils,
compile,
computed,
createApp,
createBlock,
createCommentVNode,
createElementBlock,
createBaseVNode as createElementVNode,
createHydrationRenderer,
createPropsRestProxy,
createRenderer,
createSSRApp,
createSlots,
createStaticVNode,
createTextVNode,
createVNode,
customRef,
defineAsyncComponent,
defineComponent,
defineCustomElement,
defineEmits,
defineExpose,
defineModel,
defineOptions,
defineProps,
defineSSRCustomElement,
defineSlots,
devtools,
effect,
effectScope,
getCurrentInstance,
getCurrentScope,
getTransitionRawChildren,
guardReactiveProps,
h,
handleError,
hasInjectionContext,
hydrate,
initCustomFormatter,
initDirectivesForSSR,
inject,
isMemoSame,
isProxy,
isReactive,
isReadonly,
isRef,
isRuntimeOnly,
isShallow,
isVNode,
markRaw,
mergeDefaults,
mergeModels,
mergeProps,
nextTick,
normalizeClass,
normalizeProps,
normalizeStyle,
onActivated,
onBeforeMount,
onBeforeUnmount,
onBeforeUpdate,
onDeactivated,
onErrorCaptured,
onMounted,
onRenderTracked,
onRenderTriggered,
onScopeDispose,
onServerPrefetch,
onUnmounted,
onUpdated,
openBlock,
popScopeId,
provide,
proxyRefs,
pushScopeId,
queuePostFlushCb,
reactive,
readonly,
ref,
registerRuntimeCompiler,
render,
renderList,
renderSlot,
resolveComponent,
resolveDirective,
resolveDynamicComponent,
resolveFilter,
resolveTransitionHooks,
setBlockTracking,
setDevtoolsHook,
setTransitionHooks,
shallowReactive,
shallowReadonly,
shallowRef,
ssrContextKey,
ssrUtils,
stop,
toDisplayString,
toHandlerKey,
toHandlers,
toRaw,
toRef,
toRefs,
toValue,
transformVNodeArgs,
triggerRef,
unref,
useAttrs,
useCssModule,
useCssVars,
useModel,
useSSRContext,
useSlots,
useTransitionState,
vModelCheckbox,
vModelDynamic,
vModelRadio,
vModelSelect,
vModelText,
vShow,
version,
warn,
watch,
watchEffect,
watchPostEffect,
watchSyncEffect,
withAsyncContext,
withCtx,
withDefaults,
withDirectives,
withKeys,
withMemo,
withModifiers,
withScopeId
};
//# sourceMappingURL=vue.js.map

@ -0,0 +1,7 @@
{
"version": 3,
"sources": [],
"sourcesContent": [],
"mappings": "",
"names": []
}

@ -0,0 +1,13 @@
{
"hash": "235a2a29",
"browserHash": "1935f98c",
"optimized": {
"vue": {
"src": "../../../../node_modules/.pnpm/vue@3.2.47/node_modules/vue/dist/vue.runtime.esm-bundler.js",
"file": "vue.js",
"fileHash": "9970d6ec",
"needsInterop": false
}
},
"chunks": {}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

@ -0,0 +1,13 @@
{
"hash": "235a2a29",
"browserHash": "1935f98c",
"optimized": {
"vue": {
"src": "../../../../node_modules/.pnpm/vue@3.2.47/node_modules/vue/dist/vue.runtime.esm-bundler.js",
"file": "vue.js",
"fileHash": "9970d6ec",
"needsInterop": false
}
},
"chunks": {}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

@ -0,0 +1,38 @@
const { getPosts } = require('markdown-from-posts')
async function config() {
return {
extends: {
markdown: {
headers: {
level: [2, 3]
}
},
},
themeConfig: {
posts: await getPosts(),
title: 'BBBB',
description: '自定义主题BBBB',
docRoot: '',
hasDarkSwitch: true,
homeConfig: {
headline: 'BBBB大标题',//大标题
headlineHeight: 'BBBB高亮',//大标题高亮
subheading: 'BBBB小标题',//小标题
subheadingHeight: '小标题高亮',//小标题高亮
description: '自定义主题简短banner描述',//描述
},
nav: [
{ text: '首页', link: '/', icon: '' },
{ text: '归档', link: '/pages/archives', icon: '' },
{ text: '默认', link: '/pages/default', icon: '' },
{ text: '分类', link: '/pages/category', icon: '' },
{ text: '搜索', link: '/pages/search', icon: '' },
],
footer: {
copyright: '湘ICP备aaaaaaaa-1'
}
}
}
}
module.exports = config()

@ -0,0 +1,12 @@
import { CustomTheme } from 'ppst-vitepress-theme'
// import { h } from 'vue'
import './override.css'
export default {
...CustomTheme,
// Layout() {
// return h(CustomTheme.Layout, null, {
// })
// }
}

@ -0,0 +1,97 @@
:root {
--c-main-color:#80adff;
}
/* card */
.news-box {
display: flex;
align-items: center;
width: 100%;
margin: 0 auto;
padding: 20px 0;
}
.news-box .card-item {
flex-basis: 25%;
padding: 15px;
transition: all 0.3s ease;
}
.news-box .card-item .item-box {
display: flex;
flex-direction: column;
align-items: center;
border-radius: 15px;
padding: 15px;
margin-bottom: 140px;
background: #f8f8fc;
transition: all 0.3s ease;
}
.news-box .card-item .item-box .icon {
font-size: 48px;
color: var(--c-main-color);
}
.news-box .card-item .item-box .title {
font-size: 18px;
line-height: 2;
font-weight: 500;
color: #020312;
}
.news-box .card-item .item-box .desc {
font-size: 16px;
line-height: 2;
color: #717e96;
overflow: hidden;
}
.news-box .card-item .item-box .desc {
font-size: 16px;
line-height: 2;
color: #717e96;
}
.news-box .card-item:hover .item-box {
background: var(--c-main-color);
transition: all 0.3s ease;
}
.news-box .card-item .item-box.active {
background: var(--c-main-color);
margin-bottom: 0;
}
.news-box .card-item:hover .item-box .icon,
.news-box .card-item:hover .item-box .title,
.news-box .card-item:hover .item-box .desc,
.news-box .card-item .item-box.active .icon,
.news-box .card-item .item-box.active .title,
.news-box .card-item .item-box.active .desc {
color: #fff;
}
@media (max-width: 1200px) {
.banner .banner-left {
font-size: 14px;
}
.banner .banner-left .desc {
font-size: 12px;
}
.note-box {
flex-wrap: wrap;
}
.note-box .note-item {
flex-basis: 100%;
}
.news-box {
flex-wrap: wrap;
}
.news-box .card-item {
flex-basis: 100%;
}
.news-box .card-item .item-box {
margin-bottom: 0;
}
.news-box .card-item .item-box .title {
font-size: 14px;
}
.news-box .card-item .item-box .desc {
font-size: 12px;
}
}

@ -0,0 +1,62 @@
---
page: true
date: 2021-06-30
title: 自定义标题
sidebar: false
---
<script setup>
</script>
<Home>
<template #banner>
<img src="/img/page.png" />
</template>
<template #description>
<!-- 一些其他描述 -->
</template>
<div class="card-header max-width">
<div class="title">手册</div>
<div class="desc">基础知识手册(学习基础笔记)</div>
</div>
<div class="news-box max-width">
<div class="card-item">
<div class="item-box">
<div class="icon">?</div>
<div class="title">AAA笔记</div>
<div class="desc">
我就是记录一些笔记,以及异常处理经验记录,工作中遇到问题记录解决方案
</div>
</div>
</div>
<div class="card-item">
<div class="item-box active">
<div class="icon">?</div>
<div class="title">BBB笔记</div>
<div class="desc">
我就是记录一些笔记,以及异常处理经验记录,工作中遇到问题记录解决方案
</div>
</div>
</div>
<div class="card-item">
<div class="item-box">
<div class="icon">?</div>
<div class="title">CCC笔记</div>
<div class="desc">
我就是记录一些笔记,以及异常处理经验记录,工作中遇到问题记录解决方案
</div>
</div>
</div>
<div class="card-item">
<div class="item-box active">
<div class="icon">?</div>
<div class="title">DDD笔记</div>
<div class="desc">
我就是记录一些笔记,以及异常处理经验记录,工作中遇到问题记录解决方案
</div>
</div>
</div>
</div>
</Home>

@ -0,0 +1,19 @@
{
"name": "custom-vitepress-theme-demo",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"dev": "vitepress dev --host 0.0.0.0",
"build": "vitepress build "
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"@types/node": "^18.15.11",
"markdown-from-posts": "^1.0.5",
"vitepress": "1.0.0-alpha.64",
"ppst-vitepress-theme": "^0.0.2"
}
}

@ -0,0 +1,13 @@
---
page: true
title: Archive
description: Archive
sidebar: false
---
<Archives>
<template #banner>
<img src="/img/banner.png" />
</template>
</Archives>

@ -0,0 +1,13 @@
---
page: true
title: 分类
description: 分类
sidebar: false
---
<CategoryPage title='分类' category='demo' description="分类">
<template #banner>
<img src="/img/banner.png" />
</template>
</CategoryPage>

@ -0,0 +1,13 @@
---
page: true
title: 默认
description: 默认
sidebar: false
---
<DefaultPage title='默认' category='default' description="默认">
<template #banner>
<img src="/img/banner.png" />
</template>
</DefaultPage>

@ -0,0 +1,11 @@
---
page: true
title: 搜索
description: 全文检索
sidebar: false
---
<Search>
<template #banner>
<img src="/img/banner.png" />
</template>
</Search>

@ -0,0 +1,63 @@
---
title: default
date: 2018-09-14 13:57:02
category: default
tags:
- default
---
# 主标题AAAA
## 副标题
我是内容
```js
let a = '我是js代码'
```
```css
.default{
color:red;
}
```
```shell
npm install default
```
### 副标题1
我是内容
```js
let a = '我是js代码'
```
```css
.default{
color:red;
}
```
```shell
npm install default
```
#### 副标题111
我是内容
```js
let a = '我是js代码'
```
```css
.default{
color:red;
}
```
```shell
npm install default
```

@ -0,0 +1,63 @@
---
title: demo
date: 2018-09-14 13:57:02
category: demo
tags:
- demo
---
# 主标题BBBB
## 副标题
我是内容
```js
let a = '我是js代码'
```
```css
.demo{
color:red;
}
```
```shell
npm install demo
```
### 副标题1
我是内容
```js
let a = '我是js代码'
```
```css
.demo{
color:red;
}
```
```shell
npm install demo
```
#### 副标题111
我是内容
```js
let a = '我是js代码'
```
```css
.demo{
color:red;
}
```
```shell
npm install demo
```

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 83 KiB

Loading…
Cancel
Save