From 43723a1de81956fa221866c244ac199e7d4c9a6f Mon Sep 17 00:00:00 2001 From: Charles7c Date: Sun, 24 Jul 2022 11:31:49 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=8D=E6=9E=84=EF=BC=9A=E6=89=A9=E5=B1=95?= =?UTF-8?q?=E9=BB=98=E8=AE=A4=E4=B8=BB=E9=A2=98=E9=85=8D=E7=BD=AE=EF=BC=8C?= =?UTF-8?q?=E6=96=87=E7=AB=A0=E6=A0=87=E9=A2=98=E4=B8=8B=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E4=BD=9C=E8=80=85=E5=90=8D=E5=8F=8A=E5=8F=91?= =?UTF-8?q?=E5=B8=83=E6=97=B6=E9=97=B4=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 1 + repos/.vitepress/config.ts | 11 +--- repos/.vitepress/config/markdown.ts | 16 +++++ repos/.vitepress/config/theme.ts | 8 ++- .../theme/components/ArticleMetadata.vue | 64 +++++++++++++++++++ repos/.vitepress/theme/index.ts | 3 + .../03/25.合并两个Git仓库的历史提交记录.md | 4 +- .../26.修改Git最后一次提交记录的作者和邮箱.md | 4 +- ...回收站已损坏。是否清空该驱动器上的回收站.md | 2 +- .../12/08.for循环中删除集合元素隐藏的陷阱.md | 2 +- ...o for Spring Boot default configuration.md | 2 +- repos/issues/2021/12/11.SQL 注入攻击风险.md | 2 +- ...3.无法访问F盘。文件或目录损坏且无法读取.md | 2 +- ...Script 无法存储 Java Long 类型数据问题.md | 2 +- 14 files changed, 104 insertions(+), 19 deletions(-) create mode 100644 repos/.vitepress/config/markdown.ts create mode 100644 repos/.vitepress/theme/components/ArticleMetadata.vue diff --git a/package.json b/package.json index bc3d8acd9..63609b061 100644 --- a/package.json +++ b/package.json @@ -15,6 +15,7 @@ }, "dependencies": { "@element-plus/icons-vue": "^2.0.6", + "dayjs": "^1.11.4", "element-plus": "^2.2.9", "fast-glob": "^3.2.11", "vue": "^3.2.37" diff --git a/repos/.vitepress/config.ts b/repos/.vitepress/config.ts index 23a697f88..d0891191e 100644 --- a/repos/.vitepress/config.ts +++ b/repos/.vitepress/config.ts @@ -1,6 +1,7 @@ import { defineConfig } from 'vitepress' import { metaData } from './config/constants' import { head } from './config/head' +import { markdown } from './config/markdown' import { themeConfig } from './config/theme' export default defineConfig({ @@ -9,13 +10,7 @@ export default defineConfig({ description: metaData.description, head, // 内标签配置 - themeConfig, // 主题配置 - lastUpdated: true, // 显示最后更新时间 - - // Markdown配置 - markdown: { - theme: 'one-dark-pro', // Shiki主题, 所有主题参见: https://github.com/shikijs/shiki/blob/main/docs/themes.md - lineNumbers: true // 启用行号 - } + markdown: markdown, // Markdown配置 + themeConfig // 主题配置 }) \ No newline at end of file diff --git a/repos/.vitepress/config/markdown.ts b/repos/.vitepress/config/markdown.ts new file mode 100644 index 000000000..1329a652a --- /dev/null +++ b/repos/.vitepress/config/markdown.ts @@ -0,0 +1,16 @@ +import type { MarkdownOptions } from 'vitepress' + +export const markdown: MarkdownOptions = { + theme: 'one-dark-pro', // Shiki主题, 所有主题参见: https://github.com/shikijs/shiki/blob/main/docs/themes.md + lineNumbers: true, // 启用行号 + + // 在所有文档的

标签后添加组件 + // 感谢: vitepress/@brc-dd + config: (md) => { + md.renderer.rules.heading_close = (tokens, idx, options, env, slf) => { + let htmlResult = slf.renderToken(tokens, idx, options, env, slf) + if (tokens[idx].tag === 'h1') htmlResult += `\n` + return htmlResult + } + } +} \ No newline at end of file diff --git a/repos/.vitepress/config/theme.ts b/repos/.vitepress/config/theme.ts index 498922558..eb15797ef 100644 --- a/repos/.vitepress/config/theme.ts +++ b/repos/.vitepress/config/theme.ts @@ -32,5 +32,11 @@ export const themeConfig: DefaultTheme.Config = { { icon: 'github', link: 'https://github.com/Charles7c/charles7c.github.io' } ], nav, // 导航栏配置 - sidebar // 侧边栏配置 + sidebar, // 侧边栏配置 + + // 文章元数据配置 + articleMetadataConfig: { + author: '查尔斯', // 文章全局默认作者名称 + authorLink: '/about/me' // 点击作者名时默认跳转的链接 + } } \ No newline at end of file diff --git a/repos/.vitepress/theme/components/ArticleMetadata.vue b/repos/.vitepress/theme/components/ArticleMetadata.vue new file mode 100644 index 000000000..fbc1069be --- /dev/null +++ b/repos/.vitepress/theme/components/ArticleMetadata.vue @@ -0,0 +1,64 @@ + + + + + \ No newline at end of file diff --git a/repos/.vitepress/theme/index.ts b/repos/.vitepress/theme/index.ts index cfb9041d8..18e7fe3c4 100644 --- a/repos/.vitepress/theme/index.ts +++ b/repos/.vitepress/theme/index.ts @@ -3,6 +3,7 @@ import MyLayout from "./components/MyLayout.vue" import ElementPlus from 'element-plus' import "element-plus/dist/index.css" import * as ElIcons from '@element-plus/icons-vue' +import ArticleMetadata from './components/ArticleMetadata.vue' import './styles/vars.css' import './styles/custom.css' @@ -16,5 +17,7 @@ export default { } // 全局注册ElementPlus app.use(ElementPlus) + + app.component('ArticleMetadata', ArticleMetadata) } } \ No newline at end of file diff --git a/repos/fragments/2022/03/25.合并两个Git仓库的历史提交记录.md b/repos/fragments/2022/03/25.合并两个Git仓库的历史提交记录.md index bfbd692d5..e66cf013a 100644 --- a/repos/fragments/2022/03/25.合并两个Git仓库的历史提交记录.md +++ b/repos/fragments/2022/03/25.合并两个Git仓库的历史提交记录.md @@ -1,7 +1,7 @@ --- title: 合并两个Git仓库的历史提交记录 -author: Charles7c -date: 2022/3/25 21:30 +author: 查尔斯 +date: 2022/03/25 21:30 categories: - 杂碎逆袭史 tags: diff --git a/repos/fragments/2022/03/26.修改Git最后一次提交记录的作者和邮箱.md b/repos/fragments/2022/03/26.修改Git最后一次提交记录的作者和邮箱.md index fe3dfe495..0ab927f29 100644 --- a/repos/fragments/2022/03/26.修改Git最后一次提交记录的作者和邮箱.md +++ b/repos/fragments/2022/03/26.修改Git最后一次提交记录的作者和邮箱.md @@ -1,7 +1,7 @@ --- title: 修改Git最后一次提交记录的作者和邮箱 -author: Charles7c -date: 2022/3/26 10:30 +author: 查尔斯 +date: 2022/03/26 10:30 categories: - 杂碎逆袭史 tags: diff --git a/repos/issues/2021/12/01.F盘上的回收站已损坏。是否清空该驱动器上的回收站.md b/repos/issues/2021/12/01.F盘上的回收站已损坏。是否清空该驱动器上的回收站.md index 8552c67b9..c49447148 100644 --- a/repos/issues/2021/12/01.F盘上的回收站已损坏。是否清空该驱动器上的回收站.md +++ b/repos/issues/2021/12/01.F盘上的回收站已损坏。是否清空该驱动器上的回收站.md @@ -1,6 +1,6 @@ --- title: F:\ 上的回收站已损坏。是否清空该驱动器上的"回收站"? -author: Charles7c +author: 查尔斯 date: 2021/12/01 22:36 categories: - Bug万象集 diff --git a/repos/issues/2021/12/08.for循环中删除集合元素隐藏的陷阱.md b/repos/issues/2021/12/08.for循环中删除集合元素隐藏的陷阱.md index 46814e14a..e59e9c287 100644 --- a/repos/issues/2021/12/08.for循环中删除集合元素隐藏的陷阱.md +++ b/repos/issues/2021/12/08.for循环中删除集合元素隐藏的陷阱.md @@ -1,6 +1,6 @@ --- title: for循环中删除集合元素隐藏的陷阱 -author: Charles7c +author: 查尔斯 date: 2021/12/08 20:00 categories: - Bug万象集 diff --git a/repos/issues/2021/12/10.Command line is too long. Shorten command line for XXX or also for Spring Boot default configuration.md b/repos/issues/2021/12/10.Command line is too long. Shorten command line for XXX or also for Spring Boot default configuration.md index d866ed107..f5f698657 100644 --- a/repos/issues/2021/12/10.Command line is too long. Shorten command line for XXX or also for Spring Boot default configuration.md +++ b/repos/issues/2021/12/10.Command line is too long. Shorten command line for XXX or also for Spring Boot default configuration.md @@ -1,6 +1,6 @@ --- title: Command line is too long. Shorten command line for XXX or also for Spring Boot default configuration? -author: Charles7c +author: 查尔斯 date: 2021/12/10 22:11 categories: - Bug万象集 diff --git a/repos/issues/2021/12/11.SQL 注入攻击风险.md b/repos/issues/2021/12/11.SQL 注入攻击风险.md index 1682217b2..fb29c9c5f 100644 --- a/repos/issues/2021/12/11.SQL 注入攻击风险.md +++ b/repos/issues/2021/12/11.SQL 注入攻击风险.md @@ -1,6 +1,6 @@ --- title: SQL 注入攻击风险 -author: Charles7c +author: 查尔斯 date: 2021/12/11 22:51 categories: - Bug万象集 diff --git a/repos/issues/2021/12/13.无法访问F盘。文件或目录损坏且无法读取.md b/repos/issues/2021/12/13.无法访问F盘。文件或目录损坏且无法读取.md index 999cfe5d0..1be851d1a 100644 --- a/repos/issues/2021/12/13.无法访问F盘。文件或目录损坏且无法读取.md +++ b/repos/issues/2021/12/13.无法访问F盘。文件或目录损坏且无法读取.md @@ -1,6 +1,6 @@ --- title: 无法访问 F:\。文件或目录损坏且无法读取。 -author: Charles7c +author: 查尔斯 date: 2021/12/13 22:57 categories: - Bug万象集 diff --git a/repos/issues/2022/01/26.JavaScript 无法存储 Java Long 类型数据问题.md b/repos/issues/2022/01/26.JavaScript 无法存储 Java Long 类型数据问题.md index 34ef8ea4d..c1d7491f6 100644 --- a/repos/issues/2022/01/26.JavaScript 无法存储 Java Long 类型数据问题.md +++ b/repos/issues/2022/01/26.JavaScript 无法存储 Java Long 类型数据问题.md @@ -1,6 +1,6 @@ --- title: JavaScript 无法存储 Java Long 类型数据问题 -author: Charles7c +author: 查尔斯 date: 2022/01/26 09:07 categories: - Bug万象集