Skip to content

Commit 3f3e417

Browse files
committed
docs: Add giscus support
1 parent 5b2665d commit 3f3e417

File tree

3 files changed

+28
-8
lines changed

3 files changed

+28
-8
lines changed

docs/.vitepress/theme/index.ts

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
import DefaultTheme from 'vitepress/theme'
22

3-
/* mediumZoom */
43
import mediumZoom from 'medium-zoom';
4+
import giscusTalk from 'vitepress-plugin-comment-with-giscus';
5+
import { useData, useRoute } from 'vitepress';
56
import { onMounted, watch, nextTick, h } from 'vue';
6-
import { useRoute } from 'vitepress';
77
import { NolebaseEnhancedReadabilitiesMenu, NolebaseEnhancedReadabilitiesScreenMenu } from '@nolebase/vitepress-plugin-enhanced-readabilities/client'
88

99
import './style/index.css'
1010
import '@nolebase/vitepress-plugin-enhanced-readabilities/client/style.css'
1111

12-
1312
export default {
1413
extends: DefaultTheme,
1514

15+
/* Nólëbase Integrations */
1616
Layout: () => {
1717
return h(DefaultTheme.Layout, null, {
1818
'nav-bar-content-after': () => h(NolebaseEnhancedReadabilitiesMenu),
@@ -21,9 +21,30 @@ export default {
2121
},
2222

2323

24-
/* mediumZoom */
2524
setup() {
25+
const { frontmatter } = useData();
2626
const route = useRoute();
27+
28+
/* giscus */
29+
giscusTalk({
30+
repo: 'compose-miuix-ui/miuix-giscus',
31+
repoId: 'R_kgDOQo99Eg',
32+
category: 'General',
33+
categoryId: 'DIC_kwDOQo99Es4Cz0CR',
34+
inputPosition: 'bottom',
35+
locales: {
36+
'zh_CN': 'zh-CN',
37+
'en_US': 'en'
38+
},
39+
homePageShowComment: false,
40+
},
41+
{
42+
frontmatter, route
43+
},
44+
true
45+
);
46+
47+
/* Medium Zoom */
2748
const initZoom = () => {
2849
mediumZoom('.main img', { background: 'var(--vp-c-bg)' });
2950
};

docs/.vitepress/theme/style/var.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@
4545
/* 标题颜色 */
4646
.VPDoc h1 {
4747
background: linear-gradient(120deg, var(--miuix-color-primary), var(--miuix-color-primary-container));
48-
background-clip: text;
4948
-webkit-background-clip: text;
49+
background-clip: text;
5050
-webkit-text-fill-color: transparent;
5151
}
5252

docs/package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,15 @@
22
"license": "Apache-2.0",
33
"devDependencies": {
44
"@nolebase/vitepress-plugin-enhanced-readabilities": "^2.18.2",
5+
"medium-zoom": "^1.1.0",
56
"vitepress": "^2.0.0-alpha.15",
7+
"vitepress-plugin-comment-with-giscus": "^1.1.15",
68
"vue": "^3.5.25"
79
},
810
"scripts": {
911
"docs:dev": "vitepress dev --host",
1012
"docs:build": "vitepress build",
1113
"docs:preview": "vitepress preview"
1214
},
13-
"dependencies": {
14-
"medium-zoom": "^1.1.0"
15-
},
1615
"type": "module"
1716
}

0 commit comments

Comments
 (0)