Skip to content

Commit

Permalink
美化文档
Browse files Browse the repository at this point in the history
  • Loading branch information
ikenxuan committed Aug 5, 2024
1 parent ff3a6f5 commit 52d68c4
Show file tree
Hide file tree
Showing 6 changed files with 442 additions and 104 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ config/*
data/*
.vitepress/dist/*
.vitepress/cache/*
pnpm-lock.yaml
226 changes: 140 additions & 86 deletions .vitepress/config.mts
Original file line number Diff line number Diff line change
@@ -1,8 +1,30 @@
import { defineConfig } from 'vitepress'
// 时间线
import timeline from 'vitepress-markdown-timeline'
// 任务列表
import taskLists from "markdown-it-task-lists"
// mathjax3公式支持
import mathjax3 from 'markdown-it-mathjax3'
// 页脚
import footnote_plugin from 'markdown-it-footnote'
// 双向链接
import { BiDirectionalLinks } from '@nolebase/markdown-it-bi-directional-links'
// 行内链接预览
import { InlineLinkPreviewElementTransform } from '@nolebase/vitepress-plugin-inline-link-preview/markdown-it'
// 基于git的页面历史
import {
GitChangelog,
GitChangelogMarkdownSection,
} from '@nolebase/vitepress-plugin-git-changelog/vite'
// 页面属性
import {
PageProperties,
PagePropertiesMarkdownSection
} from '@nolebase/vitepress-plugin-page-properties/vite'
// 缩略图模糊哈希生成
import { ThumbnailHashImages } from '@nolebase/vitepress-plugin-thumbnail-hash/vite'
// 代码块内的代码类型提示
import { transformerTwoslash } from '@shikijs/vitepress-twoslash'

// https://vitepress.dev/reference/site-config
export default defineConfig({
Expand All @@ -28,6 +50,38 @@ export default defineConfig({
md.use(footnote_plugin)
},
},
vite: {
plugins: [
ThumbnailHashImages(),
GitChangelog({
maxGitLogCount: 2000,
// 要获取git日志的仓库
repoURL: () => 'https://github.com/ikenxuan/kkkkkk-10086',
}),
GitChangelogMarkdownSection({
exclude: (id) => id.endsWith('index.md'),
sections: {
// 禁用页面历史
disableChangelog: false,
// 禁用贡献者
disableContributors: true,
},
}),
// 页面属性
PageProperties(),
PagePropertiesMarkdownSection({
excludes: [
'index.md',
],
}),
],
ssr: {
noExternal: [
'@nolebase/*',
],
},
},

vue: {
template: {
compilerOptions: {
Expand Down Expand Up @@ -159,91 +213,91 @@ export default defineConfig({
})

const customElements = [
'mjx-container',
'mjx-container',
'mjx-assistive-mml',
'math',
'maction',
'maligngroup',
'malignmark',
'menclose',
'merror',
'mfenced',
'mfrac',
'mi',
'mlongdiv',
'mmultiscripts',
'mn',
'mo',
'mover',
'mpadded',
'mphantom',
'mroot',
'mrow',
'ms',
'mscarries',
'mscarry',
'mscarries',
'msgroup',
'mstack',
'mlongdiv',
'msline',
'mstack',
'mspace',
'msqrt',
'msrow',
'mstack',
'mstack',
'mstyle',
'msub',
'msup',
'msubsup',
'mtable',
'mtd',
'mtext',
'mtr',
'munder',
'munderover',
'semantics',
'math',
'mi',
'mn',
'mo',
'ms',
'mspace',
'mtext',
'menclose',
'merror',
'mfenced',
'mfrac',
'mpadded',
'mphantom',
'mroot',
'mrow',
'msqrt',
'mstyle',
'mmultiscripts',
'mover',
'mprescripts',
'msub',
'msubsup',
'msup',
'munder',
'munderover',
'none',
'maligngroup',
'malignmark',
'mtable',
'mtd',
'mtr',
'mlongdiv',
'mscarries',
'mscarry',
'msgroup',
'msline',
'msrow',
'mstack',
'maction',
'semantics',
'annotation',
'annotation-xml',
'math',
'maction',
'maligngroup',
'malignmark',
'menclose',
'merror',
'mfenced',
'mfrac',
'mi',
'mlongdiv',
'mmultiscripts',
'mn',
'mo',
'mover',
'mpadded',
'mphantom',
'mroot',
'mrow',
'ms',
'mscarries',
'mscarry',
'mscarries',
'msgroup',
'mstack',
'mlongdiv',
'msline',
'mstack',
'mspace',
'msqrt',
'msrow',
'mstack',
'mstack',
'mstyle',
'msub',
'msup',
'msubsup',
'mtable',
'mtd',
'mtext',
'mtr',
'munder',
'munderover',
'semantics',
'math',
'mi',
'mn',
'mo',
'ms',
'mspace',
'mtext',
'menclose',
'merror',
'mfenced',
'mfrac',
'mpadded',
'mphantom',
'mroot',
'mrow',
'msqrt',
'mstyle',
'mmultiscripts',
'mover',
'mprescripts',
'msub',
'msubsup',
'msup',
'munder',
'munderover',
'none',
'maligngroup',
'malignmark',
'mtable',
'mtd',
'mtr',
'mlongdiv',
'mscarries',
'mscarry',
'msgroup',
'msline',
'msrow',
'mstack',
'maction',
'semantics',
'annotation',
'annotation-xml',
]
65 changes: 65 additions & 0 deletions .vitepress/theme/components/Ncard.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<script setup lang="ts">
// @ts-ignore: 2307
import { withDefaults, defineProps } from 'vue'
const props = withDefaults(
// @ts-ignore: 2307
defineProps<{
title: string,
link: string,
target?: string
}>(),
{
target: '_self'
}
)
</script>

<template>
<div class="ncard">
<a :href="props.link" :target="props.target">
<div class="ncardBody">
<div class="card-title text">{{ props.title }}</div>
<div class="card-text text">
<slot></slot>
</div>
</div>
</a>
</div>
</template>

<style scoped>
.ncard {
border: 1px solid #ebedf0;
box-shadow: 2px 2px 8px 1px rgba(0, 0, 0, .15);
margin-bottom: 2em;
border-radius: 8px;
transition: all 200ms ease;
}
.ncard:hover {
border: 1px solid var(--vp-c-brand);
box-shadow: 2px 2px 1px 0 rgba(0, 0, 0, .1);
}
.ncardBody {
padding: 1.8em;
}
a {
color: var(--vp-c-text-1);
text-decoration-line: none;
}
a::after {
content: none !important;
}
.card-title {
font-size: 1.5em;
margin-bottom: .8em;
}
.card-text {
font-size: 0.9em;
}
</style>
Loading

0 comments on commit 52d68c4

Please sign in to comment.