From d15d29b09c1006c71e661a5c011deeb60dc1f0a2 Mon Sep 17 00:00:00 2001 From: Mister-Hope Date: Wed, 5 Jun 2024 19:49:32 +0800 Subject: [PATCH 01/63] feat: init guidelines --- .../plugins/development/sass-palette/guide.md | 8 ++-- docs/plugins/features/copy-code.md | 2 +- docs/plugins/features/medium-zoom.md | 2 +- docs/plugins/features/photo-swipe.md | 2 +- docs/plugins/markdown/markdown-image.md | 4 +- docs/plugins/search/docsearch.md | 14 +++---- docs/themes/default/frontmatter.md | 2 +- docs/themes/guidelines.md | 38 +++++++++++++++++++ docs/tools/helper/client.md | 4 +- .../plugins/development/sass-palette/guide.md | 8 ++-- docs/zh/plugins/features/copy-code.md | 2 +- docs/zh/plugins/features/medium-zoom.md | 2 +- docs/zh/plugins/features/photo-swipe.md | 2 +- docs/zh/plugins/markdown/markdown-image.md | 4 +- docs/zh/plugins/search/docsearch.md | 14 +++---- docs/zh/themes/default/frontmatter.md | 2 +- docs/zh/tools/helper/client.md | 4 +- .../src/client/components/CommentService.ts | 9 +++-- .../src/client/components/WalineComment.ts | 2 +- .../src/client/styles/base.scss | 2 +- .../styles/default/config.scss | 7 +--- .../src/node/copyCodePlugin.ts | 2 +- .../plugin-copy-code/src/node/options.ts | 2 +- .../src/node/mediumZoomPlugin.ts | 4 +- .../plugin-photo-swipe/src/node/options.ts | 2 +- .../src/node/photoSwipePlugin.ts | 3 +- .../plugin-markdown-image/src/node/options.ts | 4 +- .../node/prepare/prepareClientConfigFile.ts | 4 +- .../src/client/components/VPHome.vue | 2 +- .../src/client/components/VPHomeFooter.vue | 4 +- .../src/client/components/VPNavbar.vue | 2 +- .../src/client/components/VPPage.vue | 2 +- .../src/client/components/VPSidebar.vue | 2 +- .../src/client/composables/useDarkMode.ts | 7 ++-- .../src/client/layouts/Layout.vue | 1 + .../src/client/layouts/NotFound.vue | 4 +- .../src/client/styles/arrow.scss | 2 +- .../src/client/styles/normalize.scss | 2 +- .../src/client/styles/plugins.scss | 2 +- .../src/client/styles/vars-dark.scss | 2 +- themes/theme-default/templates/build.html | 14 ++++--- tools/helper/src/client/utils/getHeaders.ts | 6 ++- 42 files changed, 125 insertions(+), 82 deletions(-) create mode 100644 docs/themes/guidelines.md diff --git a/docs/plugins/development/sass-palette/guide.md b/docs/plugins/development/sass-palette/guide.md index 9effb13581..c18334f53b 100644 --- a/docs/plugins/development/sass-palette/guide.md +++ b/docs/plugins/development/sass-palette/guide.md @@ -103,9 +103,9 @@ If the Scss file is not imported directly, but is imported through `@use` or `@i ::: tip -- If you are developing a plugin, you may set `$dark-selector: html.dark !default;` in default config files, as `@vuepress/theme-default` is doing that. +- If you are developing a plugin, you may set `$dark-selector: html[data-theme="dark"] !default;` in default config files, as our guideline is asking this. - Your plugin will work with default theme, and users are allowed to change this selector in config file if they are using a third-party theme with different dark selector. + Your plugin will work with most of theme, and users are still allowed to change this selector in config file if they are using a third-party theme with different dark selector. - If you are developing a theme, you may set `$dark-selector` in default config files with your darkmode selector without `!default`, to insure users cannot override it. @@ -180,7 +180,7 @@ $bg-color: ( ) !default; ``` -Then if `$dark-selector` has a value `"html.dark"` in config file, you will get: +Then if `$dark-selector` has a value `"html[data-theme="dark"]"` in config file, you will get: ```scss :root { @@ -188,7 +188,7 @@ Then if `$dark-selector` has a value `"html.dark"` in config file, you will get: --bg-color: #fff; } -html.dark { +html[data-theme='dark'] { --text-color: #999; --bg-color: #1e1e1e; } diff --git a/docs/plugins/features/copy-code.md b/docs/plugins/features/copy-code.md index 7c18e56430..00ecff3ec5 100644 --- a/docs/plugins/features/copy-code.md +++ b/docs/plugins/features/copy-code.md @@ -29,7 +29,7 @@ export default { ### selector - Type: `string | string[]` -- Default: `'.theme-default-content div[class*="language-"] pre'` +- Default: `'[vp-content] div[class*="language-"] pre'` - Details: Code block selector diff --git a/docs/plugins/features/medium-zoom.md b/docs/plugins/features/medium-zoom.md index 362dce2544..9148ca082f 100644 --- a/docs/plugins/features/medium-zoom.md +++ b/docs/plugins/features/medium-zoom.md @@ -30,7 +30,7 @@ export default { - Type: `string` -- Default: `':not(a) > img'` +- Default: `'[vp-content] :not(a) > img'` - Details: diff --git a/docs/plugins/features/photo-swipe.md b/docs/plugins/features/photo-swipe.md index 33e06bbddd..f80a222935 100644 --- a/docs/plugins/features/photo-swipe.md +++ b/docs/plugins/features/photo-swipe.md @@ -43,7 +43,7 @@ In preview mode, you can: ### selector - Type: `string | string[]` -- Default: `".theme-default-content :not(a) > img:not([no-view])"` +- Default: `"[vp-content] :not(a) > img:not([no-view])"` - Details: Image selector ### download diff --git a/docs/plugins/markdown/markdown-image.md b/docs/plugins/markdown/markdown-image.md index 496cdc8b51..f0751c05a6 100644 --- a/docs/plugins/markdown/markdown-image.md +++ b/docs/plugins/markdown/markdown-image.md @@ -150,13 +150,13 @@ If the image is standalone in a line, wrapped or not wrapped by link, it will be ### lightmodeSelector - Type: `string` -- Default: `'html:not(.dark)'` +- Default: `'html[data-theme="light"]'` - Details: The selector to detect light mode. ### darkmodeSelector - Type: `string` -- Default: `'html.dark'` +- Default: `'html[data-theme="dark"]'` - Details: The selector to detect dark mode.