-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
eee3b32
commit 0fa6dad
Showing
4 changed files
with
47 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { defineComponent, h } from "vue"; | ||
|
||
import { useData, useRoute } from "vitepress"; | ||
import Giscus from "@giscus/vue"; | ||
|
||
export default defineComponent({ | ||
setup() { | ||
const route = useRoute(); | ||
const { isDark } = useData(); | ||
|
||
return () => | ||
h( | ||
"div", | ||
{ | ||
style: { | ||
marginTop: "20px", | ||
}, | ||
}, | ||
h(Giscus, { | ||
repo: "learnzig/learnzig", | ||
repoId: "R_kgDOKRsb5Q", | ||
category: "Comments", | ||
categoryId: "DIC_kwDOKRsb5c4Cbx2i", | ||
mapping: "url", | ||
strict: "1", | ||
reactionsEnabled: "1", | ||
emitMetadata: "0", | ||
inputPosition: "top", | ||
theme: isDark.value ? "dark" : "light", | ||
lang: "zh-CN", | ||
term: route.path, | ||
}), | ||
); | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,53 +1,28 @@ | ||
// .vitepress/theme/index.js | ||
import DefaultTheme from "vitepress/theme"; | ||
|
||
import giscusTalk from "vitepress-plugin-comment-with-giscus"; | ||
|
||
import codeblocksFold from "vitepress-plugin-codeblocks-fold"; | ||
import "vitepress-plugin-codeblocks-fold/style/index.scss"; | ||
|
||
import "viewerjs/dist/viewer.min.css"; | ||
import imageViewer from "./ImgViewer"; | ||
|
||
import { useData, useRoute } from "vitepress"; | ||
import giscus from "./giscus"; | ||
|
||
import { useRoute } from "vitepress"; | ||
import { h } from "vue"; | ||
|
||
export default { | ||
...DefaultTheme, | ||
enhanceApp(ctx) { | ||
enhanceApp(ctx: any) { | ||
DefaultTheme.enhanceApp(ctx); | ||
}, | ||
Layout() { | ||
return h(DefaultTheme.Layout, null, { | ||
"doc-after": () => h(giscus), | ||
}); | ||
}, | ||
setup() { | ||
// Get frontmatter and route | ||
const { frontmatter } = useData(); | ||
const route = useRoute(); | ||
|
||
// code fold support | ||
codeblocksFold({ route, frontmatter }, true, 400); | ||
|
||
// imageView | ||
imageViewer(route); | ||
|
||
// Obtain configuration from: https://giscus.app/ | ||
giscusTalk( | ||
{ | ||
repo: "learnzig/learnzig", | ||
repoId: "R_kgDOKRsb5Q", | ||
category: "Comments", // default: `General` | ||
categoryId: "DIC_kwDOKRsb5c4Cbx2i", | ||
mapping: "pathname", // default: `pathname` | ||
inputPosition: "top", // default: `top` | ||
lang: "zh-CN", // default: `zh-CN` | ||
strict: "1", | ||
reactionsEnabled: "1", | ||
// theme:"dark", | ||
lightTheme: "light", | ||
darkTheme: "dark", | ||
}, | ||
{ | ||
frontmatter, | ||
route, | ||
}, | ||
true, | ||
); | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters