2023-08-05 09:05:56 +02:00
|
|
|
// .vitepress/theme/index.ts
|
2024-03-16 11:07:01 +01:00
|
|
|
import DefaultTheme from "vitepress/theme"
|
|
|
|
import giscusTalk from "vitepress-plugin-comment-with-giscus"
|
|
|
|
import { useData, useRoute } from "vitepress"
|
2023-08-05 09:05:56 +02:00
|
|
|
|
|
|
|
// custom CSS
|
2024-03-16 11:07:01 +01:00
|
|
|
import "../style/print.css"
|
2023-08-05 09:05:56 +02:00
|
|
|
|
|
|
|
export default {
|
2024-02-27 02:58:39 +01:00
|
|
|
// Extending the Default Theme
|
|
|
|
...DefaultTheme,
|
|
|
|
enhanceApp(ctx) {
|
2024-03-16 11:07:01 +01:00
|
|
|
DefaultTheme.enhanceApp(ctx)
|
2024-02-27 02:58:39 +01:00
|
|
|
// ...
|
|
|
|
},
|
|
|
|
setup() {
|
|
|
|
// Get frontmatter and route
|
2024-03-16 11:07:01 +01:00
|
|
|
const { frontmatter } = useData()
|
|
|
|
const route = useRoute()
|
2024-02-27 02:58:39 +01:00
|
|
|
|
|
|
|
// Obtain configuration from: https://giscus.app/
|
|
|
|
giscusTalk(
|
|
|
|
{
|
|
|
|
repo: "ryan4yin/nixos-and-flakes-book",
|
|
|
|
repoId: "R_kgDOJzAhDA",
|
|
|
|
category: "Announcements", // default: `General`
|
|
|
|
categoryId: "DIC_kwDOJzAhDM4CXtJ8",
|
|
|
|
mapping: "pathname", // default: `pathname`
|
|
|
|
inputPosition: "top", // default: `top`
|
|
|
|
lang: "en", // default: `zh-CN`
|
|
|
|
loading: "lazy",
|
|
|
|
lightTheme: "light", // default: `light`
|
|
|
|
darkTheme: "transparent_dark", // default: `transparent_dark`
|
|
|
|
// ...
|
|
|
|
},
|
|
|
|
{
|
|
|
|
frontmatter,
|
|
|
|
route,
|
|
|
|
},
|
|
|
|
// Whether to activate the comment area on all pages.
|
|
|
|
// The default is true, which means enabled, this parameter can be ignored;
|
|
|
|
// If it is false, it means it is not enabled.
|
|
|
|
// You can use `comment: true` preface to enable it separately on the page.
|
2024-03-16 11:07:01 +01:00
|
|
|
true
|
|
|
|
)
|
2024-02-27 02:58:39 +01:00
|
|
|
},
|
2024-03-16 11:07:01 +01:00
|
|
|
}
|