diff --git a/docs/.vuepress/themes/components/CanIUseConfig.vue b/docs/.vuepress/themes/components/CanIUseConfig.vue index 8c9e8b4f..b4306e55 100644 --- a/docs/.vuepress/themes/components/CanIUseConfig.vue +++ b/docs/.vuepress/themes/components/CanIUseConfig.vue @@ -9,25 +9,25 @@ interface Feature { value: string } -const api = 'https://api.caniuse.bitsofco.de/features' +const api = 'https://api.pengzhanbo.cn/caniuse/features' const features = useLocalStorage('caniuse-features', [] as Feature[]) onMounted(async () => { const res = await fetch(api) const data = await res.json() - features.value = data?.map((item: any) => ({ label: item.title, value: item.id })) || [] + features.value = data || features.value || [] }) const browserVersionList = ref([ - { label: '未来版本 (当前版本 + 3)', value: 3, checked: false }, - { label: '未来版本 (当前版本 + 2)', value: 2, checked: false }, - { label: '未来版本 (当前版本 + 1)', value: 1, checked: false }, + { label: '新版本(当前版本 + 3)', value: 3, checked: false }, + { label: '新版本(当前版本 + 2)', value: 2, checked: false }, + { label: '新版本(当前版本 + 1)', value: 1, checked: false }, { label: '当前版本', value: 0, disabled: true, checked: true }, - { label: '过去版本 (当前版本 - 1)', value: -1, checked: false }, - { label: '过去版本 (当前版本 - 2)', value: -2, checked: false }, - { label: '过去版本 (当前版本 - 3)', value: -3, checked: false }, - { label: '过去版本 (当前版本 - 4)', value: -4, checked: false }, - { label: '过去版本 (当前版本 - 5)', value: -5, checked: false }, + { label: '旧版本(当前版本 - 1)', value: -1, checked: false }, + { label: '旧版本(当前版本 - 2)', value: -2, checked: false }, + { label: '旧版本(当前版本 - 3)', value: -3, checked: false }, + { label: '旧版本(当前版本 - 4)', value: -4, checked: false }, + { label: '旧版本(当前版本 - 5)', value: -5, checked: false }, ]) const input = ref('') @@ -77,7 +77,7 @@ const output = computed(() => { if (embedType.value) content += ` ${embedType.value}` - if (browserVersion.value) + if (browserVersion.value && !embedType.value) content += `{${browserVersion.value}}` content += '](' @@ -131,7 +131,7 @@ function render() { -
+
+
+ +

输出:

-
- -
@@ -160,8 +160,18 @@ function render() { diff --git a/docs/.vuepress/themes/components/CodeViewer.vue b/docs/.vuepress/themes/components/CodeViewer.vue index 3b1ea74c..a2186d6a 100644 --- a/docs/.vuepress/themes/components/CodeViewer.vue +++ b/docs/.vuepress/themes/components/CodeViewer.vue @@ -6,8 +6,20 @@ defineProps<{ + + diff --git a/docs/notes/theme/guide/markdown/进阶.md b/docs/notes/theme/guide/markdown/进阶.md index d8fc7e1b..804ea107 100644 --- a/docs/notes/theme/guide/markdown/进阶.md +++ b/docs/notes/theme/guide/markdown/进阶.md @@ -108,6 +108,96 @@ github: :[tdesign:logo-github-filled]: 修改大小::[tdesign:logo-github-filled 36px]: 修改大小颜色::[tdesign:logo-github-filled 36px/#f00]: +## “隐秘”文本 + +有时候,你不想直接把文本内容毫无保留的展示出来,想要保留一些 隐秘性, +可能是为了引起读者的好奇心,也可能纯粹是故意增加点阅读障碍,让文章变得更加有趣。 + +为了满足这种小小的心思,主题提供了一个 **“隐秘”文本** 的有趣小功能。它看起来像这样: + +:::demo-wrapper +你知道吗, =|鲁迅|= 曾说过:“ =|我没说过这句话!|= ” 令我醍醐灌顶,深受启发,浑身迸发出无可匹敌的 +力量!于是,=|我在床上翻了个身|= ! +::: + +读者不能直接阅读到完整的内容,部分的内容被 “遮住”,需要鼠标悬停到内容上,才能看到被遮住的内容。 + +### 配置 + +该功能默认不启用,你需要在 `theme` 配置中启用。 + +::: code-tabs +@tab .vuepress/config.ts + +```ts +export default defineUserConfig({ + theme: plumeTheme({ + plugins: { + markdownPower: { + plot: true, + }, + } + }) +}) +``` + +::: + +`markdownPower.plot` 支持传入 `boolean | PlotOptions` 类型 + +```ts +interface PlotOptions { + /** + * 是否启用 `=| |=` markdown (该标记为非标准标记,脱离插件将不生效) + * 如果设置为 false, 则表示不启用该标记,只能使用 组件 + * @default true + */ + tag?: boolean + + /** + * 遮罩层颜色 + */ + mask?: string | { light: string, dark: string } + + /** + * 文本颜色 + */ + color?: string | { light: string, dark: string } + + /** + * 触发方式 + * + * @default 'hover' + */ + trigger?: 'hover' | 'click' +} +``` + +### 语法 + +```md +=|需要隐秘的内容|= +``` + +如果不想使用 非标准的 `=||=` 标记语法,你可以将 `plot.tag` 设置为 `false` , +然后使用 [``](/guide/features/component/#plot) 组件替代。 + +### 示例 + +输入: + +```md +你知道吗, =|鲁迅|= 曾说过:“ =|我没说过这句话!|= ” 令我醍醐灌顶,深受启发,浑身迸发出无可匹敌的 +力量!于是,=|我在床上翻了个身|= ! +``` + +输出: + +:::demo-wrapper +你知道吗, =|鲁迅|= 曾说过:“ =|我没说过这句话!|= ” 令我醍醐灌顶,深受启发,浑身迸发出无可匹敌的 +力量!于是,=|我在床上翻了个身|= ! +::: + ## 选项组 让你的 Markdown 文件支持选项卡。 diff --git a/docs/notes/theme/guide/介绍.md b/docs/notes/theme/guide/介绍.md index 249a7778..7bda7f2b 100644 --- a/docs/notes/theme/guide/介绍.md +++ b/docs/notes/theme/guide/介绍.md @@ -17,7 +17,10 @@ VuePress 是一个 [静态站点生成器](https://en.wikipedia.org/wiki/Static_ ::: tip 本主题 基于 [vuepress-next](https://github.com/vuepress/vuepress-next), 目前处于 RC 阶段。 -功能和API 趋于稳定,但在未来的更新中仍有小概率出现破坏更改。 +当前主题 功能和 API 趋于稳定,但在未来的更新中仍有小概率出现破坏更改。 + +如果您在使用过程中遇到问题,或者有新的想法,请在 [Issues](https://github.com/pengzhanbo/vuepress-theme-plume/issues) 里提出, +也欢迎 通过 [PR](https://github.com/pengzhanbo/vuepress-theme-plume/pulls) 帮助完善主题。 ::: ## 优势 diff --git a/docs/notes/theme/guide/功能/组件.md b/docs/notes/theme/guide/功能/组件.md index 815bf047..459e1df0 100644 --- a/docs/notes/theme/guide/功能/组件.md +++ b/docs/notes/theme/guide/功能/组件.md @@ -70,3 +70,55 @@ permalink: /guide/features/component/ - home - - vscode - - twitter - + +## `` + +[“隐秘”文本](/guide/markdown/advance/#隐秘-文本) 组件。 + +该组件默认不启用,你需要在 theme 配置中启用。 + +::: code-tabs +@tab .vuepress/config.ts + +```ts +export default defineUserConfig({ + theme: plumeTheme({ + plugins: { + markdownPower: { + plot: true, + }, + } + }) +}) +``` + +::: + +### Props + +- `trigger` + - 类型:`'hover' | 'click'` + - 默认值:`'hover'` + - 描述:鼠标悬停触发,或者点击触发 + +- `mask` + - 类型:`string | { light: string, dark: string }` + - 默认值:`#000` + - 描述:遮罩颜色 + +- `color` + - 类型:`string | { light: string, dark: string }` + - 默认值:`#fff` + - 描述:文本颜色 + +输入: + +```md +- 鼠标悬停 - 悬停时可见 +- 点击 - 点击时可见 +``` + +输出: + +- 鼠标悬停 - 悬停时可见 +- 点击 - 点击时可见 diff --git a/plugins/plugin-md-power/src/client/config.ts b/plugins/plugin-md-power/src/client/config.ts index 5758aa29..2f2d6e22 100644 --- a/plugins/plugin-md-power/src/client/config.ts +++ b/plugins/plugin-md-power/src/client/config.ts @@ -7,6 +7,7 @@ import Bilibili from './components/Bilibili.vue' import Youtube from './components/Youtube.vue' import Replit from './components/Replit.vue' import CodeSandbox from './components/CodeSandbox.vue' +import Plot from './components/Plot.vue' import '@internal/md-power/icons.css' @@ -29,6 +30,9 @@ export default defineClientConfig({ if (pluginOptions.codeSandbox) app.component('CodeSandboxViewer', CodeSandbox) + if (pluginOptions.plot) + app.component('Plot', Plot) + if (__VUEPRESS_SSR__) return diff --git a/plugins/plugin-md-power/src/node/plugin.ts b/plugins/plugin-md-power/src/node/plugin.ts index 33f1aaf2..ee64e4cf 100644 --- a/plugins/plugin-md-power/src/node/plugin.ts +++ b/plugins/plugin-md-power/src/node/plugin.ts @@ -10,6 +10,7 @@ import { codepenPlugin } from './features/codepen.js' import { replitPlugin } from './features/replit.js' import { codeSandboxPlugin } from './features/codeSandbox.js' import { jsfiddlePlugin } from './features/jsfiddle.js' +import { plotPlugin } from './features/plot.js' const __dirname = getDirname(import.meta.url) @@ -76,6 +77,14 @@ export function markdownPowerPlugin(options: MarkdownPowerPluginOptions = {}): P // @[jsfiddle](user/id) md.use(jsfiddlePlugin) } + + if ( + options.plot === true + || (typeof options.plot === 'object' && options.plot.tag !== false) + ) { + // =|plot|= + md.use(plotPlugin) + } }, } } diff --git a/theme/src/client/components/Home/HomeBanner.vue b/theme/src/client/components/Home/HomeBanner.vue index 292d3de7..2dc26d21 100644 --- a/theme/src/client/components/Home/HomeBanner.vue +++ b/theme/src/client/components/Home/HomeBanner.vue @@ -8,7 +8,7 @@ import VButton from '../VButton.vue' const props = defineProps() -const DEFAULT_BANNER = 'http://file.mo7.cc/api/public/bz' +const DEFAULT_BANNER = 'https://api.pengzhanbo.cn/wallpaper/bing' const matter = usePageFrontmatter() const isDark = useDarkMode()