Appearance
Mild Theme 使用 giscus 评论系统, 用于让阅读者能够对文章进行评论.
Mild Theme
<script src="https://giscus.app/client.js" data-repo="hacxy/hacxy.cn" data-repo-id="R_kgDONKDzuw" data-category="Announcements" data-category-id="DIC_kwDONKDzu84Cj_Jz" data-mapping="title" data-strict="1" data-reactions-enabled="1" data-emit-metadata="0" data-input-position="bottom" data-theme="preferred_color_scheme" data-lang="zh-CN" crossorigin="anonymous" async ></script>
为主题开启文章评论功能, 你只需要在 themeConfig中加入comment选项, 并按照最终生成的代码添加到对应的配置中:
themeConfig
comment
import type { ThemeConfig } from 'vitepress-theme-mild'; import { defineConfigWithTheme } from 'vitepress'; import baseConfig from 'vitepress-theme-mild/config'; export default defineConfigWithTheme<ThemeConfig>({ extends: baseConfig, themeConfig: { comment: { repo: 'hacxy/vitepress-theme-mild', repoId: 'R_kgDOLdAvmA', category: 'Announcements', categoryId: 'DIC_kwDOLdAvmM4Cl3ba', mapping: 'title', strict: '1', reactionsEnabled: '1', inputPosition: 'bottom', lang: 'zh-CN', darkTheme: 'catppuccin_macchiato', // 夜间主题 lightTheme: 'catppuccin_latte' // 浅色主题 }, }, });
唯一有区别的在于主题: theme 这个选项, 我将它区分为了两种情况下分别展示不同颜色的主题:
theme
darkTheme
lightTheme
效果如下:
评论
Mild Theme
使用 giscus 评论系统, 用于让阅读者能够对文章进行评论.先决条件
开启评论
为主题开启文章评论功能, 你只需要在
themeConfig
中加入comment
选项, 并按照最终生成的代码添加到对应的配置中:唯一有区别的在于主题:
theme
这个选项, 我将它区分为了两种情况下分别展示不同颜色的主题:darkTheme
当处于夜间主题时, 将以此主题进行显示lightTheme
当处于浅色主题时, 将以此主题进行显示效果如下: