Skip to content

Commit

Permalink
feat(docs): add giscus
Browse files Browse the repository at this point in the history
  • Loading branch information
aooiuu committed Oct 14, 2024
1 parent 760f535 commit 5a320c3
Show file tree
Hide file tree
Showing 8 changed files with 114 additions and 5 deletions.
27 changes: 27 additions & 0 deletions docs/.vitepress/components/GiscusComment/index.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<template>
<div style="margin-top: 24px">
<Giscus
id="comments"
:key="route.path"
repo="aooiuu/any-reader"
repo-id="R_kgDOLDIGcg"
category="🔒giscus"
category-id="DIC_kwDOLDIGcs4CcsAX"
mapping="title"
term="Welcome to giscus!"
reactionsenabled="1"
emit-metadata="0"
inputposition="top"
loading="lazy"
:theme="isDark ? 'dark' : 'light'"
></Giscus>
</div>
</template>

<script setup>
import Giscus from '@giscus/vue';
import { useRoute, useData } from 'vitepress';
const route = useRoute();
const { isDark } = useData();
</script>
8 changes: 8 additions & 0 deletions docs/.vitepress/theme/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { h } from 'vue';
import Theme from 'vitepress/theme';
import TwoslashFloatingVue from '@shikijs/vitepress-twoslash/client';
import '@shikijs/vitepress-twoslash/style.css';
Expand All @@ -6,10 +7,17 @@ import './style.css';
import RulePlay from '../components/RulePlay/index.vue';
import RuleComparess from '../components/RuleComparess/index.vue';
import Playground from '../components/Playground/index.vue';
import GiscusComment from '../components/GiscusComment/index.vue';

export default {
...Theme,

Layout() {
return h(Theme.Layout, null, {
'doc-after': () => h(GiscusComment)
});
},

enhanceApp({ app }) {
app.use(TwoslashFloatingVue);
app.component('RulePlay', RulePlay);
Expand Down
2 changes: 1 addition & 1 deletion docs/cli/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
outline: deep
---

# CLI
# 命令行工具

> 命令行工具
Expand Down
2 changes: 1 addition & 1 deletion docs/help/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
outline: deep
---

# any-reader
# 常见问题

## 参与开发

Expand Down
1 change: 1 addition & 0 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"@any-reader/rule-utils": "workspace:^",
"@codemirror/lang-javascript": "^6.2.2",
"@codemirror/theme-one-dark": "^6.1.2",
"@giscus/vue": "^3.0.0",
"@shikijs/vitepress-twoslash": "^1.18.0",
"codemirror": "^6.0.1",
"js-base64": "^3.7.7",
Expand Down
2 changes: 2 additions & 0 deletions docs/play/core.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# 规则测试

> 开发中!
>
> 目前在线工具规则部分不支持 `@filter`, 仅支持部分 `@js`
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
"epub:build": "pnpm --filter=@any-reader/epub build",
"build:web": "pnpm --filter=@any-reader/web build",
"build:web-w": "pnpm --filter=@any-reader/web build:w",
"run:vsc": "npm-run-all core:build build:web-w",
"docs": "pnpm --filter docs docs:dev",
"build:docs": "pnpm --filter docs docs:build",
"run:server": "run-p server run:web",
Expand All @@ -48,8 +47,9 @@
"web:dev": "npm-run-all --parallel web:server server",
"electron:server": "pnpm --filter=@any-reader/web electron:dev",
"electron:build": "pnpm --filter=@any-reader/web electron:build",
"vscode:server": "pnpm --filter=@any-reader/web vscode:dev",
"vscode:dev": "npm-run-all core:build shared:build --parallel vscode:server server",
"vscode:compile": "pnpm --filter=@any-reader/vscode dev",
"vscode:dev": "npm-run-all build:web-w vscode:compile",
"vscode:web": "npm-run-all --parallel vscode:server server",
"vscode:build-tpl": "pnpm --filter=@any-reader/web vscode:build",
"vscode:build-vsx": "pnpm --filter=@any-reader/vscode build",
"vscode:build": "npm-run-all vscode:build-tpl vscode:build-vsx",
Expand Down
71 changes: 71 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 5a320c3

Please sign in to comment.