update: support comment
This commit is contained in:
parent
e35b1d3ca7
commit
1c49d85ada
@ -3,6 +3,7 @@
|
||||
"workspaces": [
|
||||
"packages/*"
|
||||
],
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"docs:vite-serve": "vuepress-vite dev docs",
|
||||
"docs:vite-build": "vuepress-vite build docs",
|
||||
|
||||
@ -55,6 +55,7 @@
|
||||
"sass-loader": "^12.6.0",
|
||||
"vue": "^3.2.31",
|
||||
"vue-router": "^4.0.14",
|
||||
"vuepress-plugin-comment2": "^2.0.0-beta.36",
|
||||
"vuepress-plugin-copy-code2": "^2.0.0-beta.36",
|
||||
"vuepress-plugin-md-enhance": "^2.0.0-beta.36",
|
||||
"vuepress-plugin-reading-time2": "^2.0.0-beta.36",
|
||||
|
||||
@ -5,11 +5,12 @@ import { usePageData } from '@vuepress/client'
|
||||
import { computed } from 'vue'
|
||||
import { useRoute } from 'vue-router'
|
||||
import type { PlumeThemePageData } from '../../shared'
|
||||
import { useThemeLocaleData } from '../composables'
|
||||
import { useDarkMode, useThemeLocaleData } from '../composables'
|
||||
import Toc from './Toc'
|
||||
const page = usePageData<PlumeThemePageData>()
|
||||
const route = useRoute()
|
||||
const themeLocale = useThemeLocaleData()
|
||||
const isDarkMode = useDarkMode()
|
||||
|
||||
const isNote = computed(() => {
|
||||
return page.value.isNote || false
|
||||
@ -25,6 +26,9 @@ const isNote = computed(() => {
|
||||
<h1>{{ page.title }}</h1>
|
||||
<PostMeta :post="page" type="post" :border="true" />
|
||||
<Content />
|
||||
<div class="comment-container">
|
||||
<CommentService :darkmode="isDarkMode" />
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="page.headers?.length > 0" class="plume-theme-page-toc">
|
||||
<Toc />
|
||||
@ -66,4 +70,7 @@ const isNote = computed(() => {
|
||||
}
|
||||
}
|
||||
}
|
||||
.comment-container {
|
||||
margin-top: 8rem;
|
||||
}
|
||||
</style>
|
||||
|
||||
18
packages/theme/src/node/plugins/comment.ts
Normal file
18
packages/theme/src/node/plugins/comment.ts
Normal file
@ -0,0 +1,18 @@
|
||||
import type { PluginConfig } from '@vuepress/core'
|
||||
import type { CommentOptions } from 'vuepress-plugin-comment2'
|
||||
import { comment } from 'vuepress-plugin-comment2'
|
||||
import type { PlumeThemePluginOptions } from '../../shared'
|
||||
|
||||
export const resolveComment = (
|
||||
plugins: PlumeThemePluginOptions
|
||||
): PluginConfig => {
|
||||
if (plugins.comment === false) return ['', false]
|
||||
const option: Partial<CommentOptions> = {
|
||||
type: 'giscus',
|
||||
comment: true,
|
||||
}
|
||||
return comment({
|
||||
...(option as CommentOptions),
|
||||
...(plugins.comment as CommentOptions),
|
||||
})
|
||||
}
|
||||
@ -5,6 +5,7 @@ import type {
|
||||
} from '../../shared'
|
||||
import { resolveActiveHeaderLink } from './activeHeaderLink'
|
||||
import { resolveCanIUse } from './caniuse'
|
||||
import { resolveComment } from './comment'
|
||||
import { resolveCopyCode } from './copyCode'
|
||||
import { resolveExternalLinkIconPlugin } from './externalLinkIcon'
|
||||
import { resolveMarkdownEnhance } from './markdownEnhance'
|
||||
@ -31,6 +32,7 @@ export const getPlugins = (
|
||||
resolvePrismjs(plugins),
|
||||
resolveCopyCode(plugins),
|
||||
resolveMarkdownEnhance(plugins),
|
||||
resolveComment(plugins),
|
||||
resolveThemeData(localeOptions),
|
||||
].filter((item) => item[1] !== false)
|
||||
}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
import type { CanIUsePluginOptions } from '@vuepress-plume/vuepress-plugin-caniuse'
|
||||
import type { DocsearchOptions } from '@vuepress/plugin-docsearch'
|
||||
import type { SearchPluginOptions } from '@vuepress/plugin-search'
|
||||
import type { CommentOptions } from 'vuepress-plugin-comment2'
|
||||
import type { CopyCodeOptions } from 'vuepress-plugin-copy-code2'
|
||||
import type { MarkdownEnhanceOptions } from 'vuepress-plugin-md-enhance'
|
||||
export interface PlumeThemePluginOptions {
|
||||
@ -33,4 +34,6 @@ export interface PlumeThemePluginOptions {
|
||||
copyCode?: false | CopyCodeOptions
|
||||
|
||||
markdownEnhance?: false | MarkdownEnhanceOptions
|
||||
|
||||
comment?: false | CommentOptions
|
||||
}
|
||||
|
||||
66
yarn.lock
66
yarn.lock
@ -1088,6 +1088,11 @@
|
||||
npmlog "^4.1.2"
|
||||
write-file-atomic "^3.0.3"
|
||||
|
||||
"@lit/reactive-element@^1.3.0":
|
||||
version "1.3.1"
|
||||
resolved "https://registry.yarnpkg.com/@lit/reactive-element/-/reactive-element-1.3.1.tgz#3021ad0fa30a75a41212c5e7f1f169c5762ef8bb"
|
||||
integrity sha512-nOJARIr3pReqK3hfFCSW2Zg/kFcFsSAlIE7z4a0C9D2dPrgD/YSn3ZP2ET/rxKB65SXyG7jJbkynBRm+tGlacw==
|
||||
|
||||
"@mr-hope/vuepress-shared@2.0.0-beta.36":
|
||||
version "2.0.0-beta.36"
|
||||
resolved "https://registry.yarnpkg.com/@mr-hope/vuepress-shared/-/vuepress-shared-2.0.0-beta.36.tgz#9bbd5d5e4d44064357af53fdd968aa28646d58bc"
|
||||
@ -1587,6 +1592,11 @@
|
||||
dependencies:
|
||||
"@types/node" "*"
|
||||
|
||||
"@types/trusted-types@^2.0.2":
|
||||
version "2.0.2"
|
||||
resolved "https://registry.yarnpkg.com/@types/trusted-types/-/trusted-types-2.0.2.tgz#fc25ad9943bcac11cceb8168db4f275e0e72e756"
|
||||
integrity sha512-F5DIZ36YVLE+PN+Zwws4kJogq47hNgX3Nx6WyDJ3kcplxyke3XIzB8uK5n/Lpm1HBsbGzd6nmGehL8cPekP+Tg==
|
||||
|
||||
"@types/webpack-env@^1.16.3":
|
||||
version "1.16.3"
|
||||
resolved "https://registry.yarnpkg.com/@types/webpack-env/-/webpack-env-1.16.3.tgz#b776327a73e561b71e7881d0cd6d34a1424db86a"
|
||||
@ -2099,6 +2109,11 @@
|
||||
dependencies:
|
||||
vue-demi "*"
|
||||
|
||||
"@waline/client@^1.6.0":
|
||||
version "1.6.0"
|
||||
resolved "https://registry.yarnpkg.com/@waline/client/-/client-1.6.0.tgz#4de2c6262c4cb8a8554308dd3844c42a17a8d7f9"
|
||||
integrity sha512-nVjNh4l0GiO1D//aJj/6N6oCgFikhRqs4Juc9sbT2g9w+FxeEYosOc5PMlyDvp8JXGGla8uFuzhD8em5o7QZ3g==
|
||||
|
||||
"@webassemblyjs/ast@1.11.1":
|
||||
version "1.11.1"
|
||||
resolved "https://registry.yarnpkg.com/@webassemblyjs/ast/-/ast-1.11.1.tgz#2bfd767eae1a6996f432ff7e8d7fc75679c0b6a7"
|
||||
@ -5482,6 +5497,13 @@ getpass@^0.1.1:
|
||||
dependencies:
|
||||
assert-plus "^1.0.0"
|
||||
|
||||
giscus@^1.0.1:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/giscus/-/giscus-1.0.1.tgz#e84824aa8d00db3a9fc054f41a05098b4fafb1a9"
|
||||
integrity sha512-iUiGioxlkcSvlB7YDRfA3Cp0+bEArhgtPLAEEmXXwgLHmBn6KwiMPW6qHS6tdLohX5XqdwegYoFjA4GIAN8mZg==
|
||||
dependencies:
|
||||
lit "^2.2.1"
|
||||
|
||||
git-raw-commits@^2.0.8:
|
||||
version "2.0.11"
|
||||
resolved "https://registry.yarnpkg.com/git-raw-commits/-/git-raw-commits-2.0.11.tgz#bc3576638071d18655e1cc60d7f524920008d723"
|
||||
@ -6756,6 +6778,30 @@ linkify-it@^3.0.1:
|
||||
dependencies:
|
||||
uc.micro "^1.0.1"
|
||||
|
||||
lit-element@^3.2.0:
|
||||
version "3.2.0"
|
||||
resolved "https://registry.yarnpkg.com/lit-element/-/lit-element-3.2.0.tgz#9c981c55dfd9a8f124dc863edb62cc529d434db7"
|
||||
integrity sha512-HbE7yt2SnUtg5DCrWt028oaU4D5F4k/1cntAFHTkzY8ZIa8N0Wmu92PxSxucsQSOXlODFrICkQ5x/tEshKi13g==
|
||||
dependencies:
|
||||
"@lit/reactive-element" "^1.3.0"
|
||||
lit-html "^2.2.0"
|
||||
|
||||
lit-html@^2.2.0:
|
||||
version "2.2.1"
|
||||
resolved "https://registry.yarnpkg.com/lit-html/-/lit-html-2.2.1.tgz#762f112a8b54eaf0bbae3f516de935a25dcc12d1"
|
||||
integrity sha512-AiJ/Rs0awjICs2FioTnHSh+Np5dhYSkyRczKy3wKjp8qjLhr1Ov+GiHrUQNdX8ou1LMuznpIME990AZsa/tR8g==
|
||||
dependencies:
|
||||
"@types/trusted-types" "^2.0.2"
|
||||
|
||||
lit@^2.2.1:
|
||||
version "2.2.1"
|
||||
resolved "https://registry.yarnpkg.com/lit/-/lit-2.2.1.tgz#4b679e1d8cb6c7977b64921b1ea3eca7850ca1dd"
|
||||
integrity sha512-dSe++R50JqrvNGXmI9OE13de1z5U/Y3J2dTm/9GC86vedI8ILoR8ZGnxfThFpvQ9m0lR0qRnIR4IiKj/jDCfYw==
|
||||
dependencies:
|
||||
"@lit/reactive-element" "^1.3.0"
|
||||
lit-element "^3.2.0"
|
||||
lit-html "^2.2.0"
|
||||
|
||||
load-json-file@^4.0.0:
|
||||
version "4.0.0"
|
||||
resolved "https://registry.yarnpkg.com/load-json-file/-/load-json-file-4.0.0.tgz#2f5f45ab91e33216234fd53adab668eb4ec0993b"
|
||||
@ -9864,6 +9910,11 @@ tweetnacl@^0.14.3, tweetnacl@~0.14.0:
|
||||
resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-0.14.5.tgz#5ae68177f192d4456269d108afa93ff8743f4f64"
|
||||
integrity sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=
|
||||
|
||||
twikoo@^1.5.1:
|
||||
version "1.5.1"
|
||||
resolved "https://registry.yarnpkg.com/twikoo/-/twikoo-1.5.1.tgz#5aea9d4952bec7cdd18159b653643dfa43a84dbe"
|
||||
integrity sha512-tHdjuA0kKvGOK3vOrtX70D8+eJL9OoonwOyGxw5H8hiPXrm+4HWy1EsODJMNcZ74xdCjL2aRmYXFaeNKbSj4jQ==
|
||||
|
||||
type-check@^0.4.0, type-check@~0.4.0:
|
||||
version "0.4.0"
|
||||
resolved "https://registry.yarnpkg.com/type-check/-/type-check-0.4.0.tgz#07b8203bfa7056c0657050e3ccd2c37730bab8f1"
|
||||
@ -10202,6 +10253,21 @@ vue@^3.2.31:
|
||||
"@vue/server-renderer" "3.2.31"
|
||||
"@vue/shared" "3.2.31"
|
||||
|
||||
vuepress-plugin-comment2@^2.0.0-beta.36:
|
||||
version "2.0.0-beta.36"
|
||||
resolved "https://registry.yarnpkg.com/vuepress-plugin-comment2/-/vuepress-plugin-comment2-2.0.0-beta.36.tgz#3248da039bfe1bbcc792b3e0578b92284038e144"
|
||||
integrity sha512-P18bzxIb74IfpaweXwK5VNgY5k4F0wAIIr7eKQAzvjCug31AKkiAn9Js4uitQaEszZfBUBraua5PjvrgNN3E8g==
|
||||
dependencies:
|
||||
"@mr-hope/vuepress-shared" "2.0.0-beta.36"
|
||||
"@vuepress/client" "2.0.0-beta.38"
|
||||
"@vuepress/utils" "2.0.0-beta.38"
|
||||
"@waline/client" "^1.6.0"
|
||||
giscus "^1.0.1"
|
||||
twikoo "^1.5.1"
|
||||
vue "^3.2.31"
|
||||
vue-router "^4.0.14"
|
||||
vuepress-plugin-sass-palette "2.0.0-beta.36"
|
||||
|
||||
vuepress-plugin-copy-code2@^2.0.0-beta.36:
|
||||
version "2.0.0-beta.36"
|
||||
resolved "https://registry.yarnpkg.com/vuepress-plugin-copy-code2/-/vuepress-plugin-copy-code2-2.0.0-beta.36.tgz#7a5f3e424f52ef6f630ab95fa4dfb7f01d419fd0"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user