diff --git a/cli/src/run.ts b/cli/src/run.ts index 3c153672..f9ebfa01 100644 --- a/cli/src/run.ts +++ b/cli/src/run.ts @@ -1,3 +1,5 @@ +import process from 'node:process' +import path from 'node:path' import { intro, outro, spinner } from '@clack/prompts' import { execaCommand } from 'execa' import colors from 'picocolors' @@ -19,16 +21,17 @@ export async function run(mode: Mode, root?: string) { await generate(mode, data) + const cwd = path.join(process.cwd(), data.root) if (data.git) { progress.message(t('spinner.git')) - await execaCommand('git init') + await execaCommand('git init', { cwd }) } const pm = data.packageManager if (data.install) { progress.message(t('spinner.install')) - await execaCommand(pm === 'yarn' ? 'yarn' : `${pm} install`) + await execaCommand(pm === 'yarn' ? 'yarn' : `${pm} install`, { cwd }) } const cdCommand = mode === Mode.create ? colors.green(`cd ${data.root}`) : '' diff --git a/docs/.vuepress/notes.ts b/docs/.vuepress/notes.ts deleted file mode 100644 index c3a25f95..00000000 --- a/docs/.vuepress/notes.ts +++ /dev/null @@ -1,165 +0,0 @@ -import { defineNotesConfig } from 'vuepress-theme-plume' - -export const zhNotes = defineNotesConfig({ - dir: 'notes', - link: '/', - notes: [ - { - dir: 'theme/guide', - link: '/guide/', - sidebar: [ - { - text: '快速开始', - collapsed: false, - icon: 'carbon:idea', - items: ['介绍', '安装与使用', '博客', '知识笔记', '编写文章', '国际化', '部署'], - }, - { - text: '写作', - icon: 'fluent-mdl2:edit-create', - collapsed: false, - items: [ - { - text: 'markdown', - icon: 'material-symbols:markdown-outline', - prefix: 'markdown', - collapsed: true, - items: ['基础', '扩展', '进阶'], - }, - { - text: '代码块', - prefix: '代码', - icon: 'ph:code-bold', - collapsed: true, - items: ['介绍', '特性支持', '代码组', '导入代码', 'twoslash'], - }, - { - text: '代码演示', - prefix: '代码演示', - icon: 'carbon:demo', - collapsed: true, - items: ['前端', 'rust', 'golang', 'kotlin', 'codepen', 'jsFiddle', 'codeSandbox', 'replit'], - }, - { - text: '图表', - icon: 'mdi:chart-line', - prefix: '图表', - collapsed: true, - items: ['chart', 'echarts', 'mermaid', 'flowchart'], - }, - { - text: '资源嵌入', - icon: 'dashicons:embed-video', - prefix: '嵌入', - collapsed: true, - items: ['pdf', 'bilibili', 'youtube'], - }, - ], - }, - { - text: '功能', - icon: 'lucide:box', - collapsed: false, - prefix: '功能', - items: ['图标', '代码复制', '内容搜索', '评论', '加密', '文章水印', '友情链接页', 'seo', 'sitemap'], - }, - { - text: '组件', - prefix: '组件', - icon: 'uiw:component', - collapsed: false, - items: ['徽章', '图标', '隐秘文本', '卡片', '链接卡片', '图片卡片', '卡片容器', '首页布局容器', 'repoCard', 'npmBadge'], - }, - { - text: '自定义', - icon: 'material-symbols:dashboard-customize-outline-rounded', - collapsed: false, - items: ['自定义首页', '自定义样式', '布局插槽', '组件覆写'], - }, - { - text: 'API', - icon: 'mdi:api', - collapsed: false, - items: ['api-客户端', 'api-node'], - }, - ], - }, - { - dir: 'theme/config', - link: '/config/', - sidebar: [ - { - text: '配置', - collapsed: false, - items: [ - '配置说明', - '多语言配置', - '主题配置', - '导航栏配置', - 'notes配置', - '侧边栏配置', - ], - }, - { - text: 'frontmatter', - prefix: 'frontmatter', - collapsed: false, - items: ['basic', 'home', 'post', 'friend'], - }, - { - text: '内置插件', - prefix: 'plugins', - collapsed: false, - items: ['', '代码高亮', '搜索', '阅读统计', 'markdown增强', 'markdownPower', '百度统计', '水印'], - }, - ], - }, - { - dir: 'plugins', - link: '/plugins/', - sidebar: [ - { - text: '插件', - link: '/plugins/', - items: [ - // 'caniuse', - // 'iconify', - 'shiki', - 'md-power', - 'content-updated', - { - text: 'plugin-netlify-functions', - dir: 'netlify-functions', - link: '/plugins/plugin-netlify-functions/', - collapsed: true, - items: [ - '介绍', - '使用', - '功能', - 'api', - 'functions', - ], - }, - ], - }, - ], - }, - { - dir: 'tools', - link: '/tools/', - sidebar: [ - { - text: '工具', - icon: 'tabler:tools', - items: ['custom-theme', 'home-hero-tint-plate', 'caniuse'], - }, - ], - }, - ], -}) - -export const enNotes = defineNotesConfig({ - dir: 'en/notes', - link: '/', - notes: [], -}) diff --git a/docs/.vuepress/notes/en/index.ts b/docs/.vuepress/notes/en/index.ts new file mode 100644 index 00000000..72e649b7 --- /dev/null +++ b/docs/.vuepress/notes/en/index.ts @@ -0,0 +1,7 @@ +import { defineNotesConfig } from 'vuepress-theme-plume' + +export const enNotes = defineNotesConfig({ + dir: 'en/notes', + link: '/', + notes: [], +}) diff --git a/docs/.vuepress/notes/index.ts b/docs/.vuepress/notes/index.ts new file mode 100644 index 00000000..ef42cf6b --- /dev/null +++ b/docs/.vuepress/notes/index.ts @@ -0,0 +1,2 @@ +export * from './en/index.js' +export * from './zh/index.js' diff --git a/docs/.vuepress/notes/zh/index.ts b/docs/.vuepress/notes/zh/index.ts new file mode 100644 index 00000000..fed5583d --- /dev/null +++ b/docs/.vuepress/notes/zh/index.ts @@ -0,0 +1,16 @@ +import { defineNotesConfig } from 'vuepress-theme-plume' +import { themeGuide } from './theme-guide' +import { themeConfig } from './theme-config' +import { plugins } from './plugins' +import { tools } from './tools' + +export const zhNotes = defineNotesConfig({ + dir: 'notes', + link: '/', + notes: [ + themeGuide, + themeConfig, + plugins, + tools, + ], +}) diff --git a/docs/.vuepress/notes/zh/plugins.ts b/docs/.vuepress/notes/zh/plugins.ts new file mode 100644 index 00000000..87379775 --- /dev/null +++ b/docs/.vuepress/notes/zh/plugins.ts @@ -0,0 +1,32 @@ +import { defineNoteConfig } from 'vuepress-theme-plume' + +export const plugins = defineNoteConfig({ + dir: 'plugins', + link: '/plugins/', + sidebar: [ + { + text: '插件', + link: '/plugins/', + items: [ + // 'caniuse', + // 'iconify', + 'shiki', + 'md-power', + 'content-updated', + { + text: 'plugin-netlify-functions', + dir: 'netlify-functions', + link: '/plugins/plugin-netlify-functions/', + collapsed: true, + items: [ + '介绍', + '使用', + '功能', + 'api', + 'functions', + ], + }, + ], + }, + ], +}) diff --git a/docs/.vuepress/notes/zh/theme-config.ts b/docs/.vuepress/notes/zh/theme-config.ts new file mode 100644 index 00000000..5eb18f45 --- /dev/null +++ b/docs/.vuepress/notes/zh/theme-config.ts @@ -0,0 +1,46 @@ +import { defineNoteConfig } from 'vuepress-theme-plume' + +export const themeConfig = defineNoteConfig({ + dir: 'theme/config', + link: '/config/', + sidebar: [ + { + text: '配置', + collapsed: false, + items: [ + '配置说明', + '多语言配置', + '主题配置', + '导航栏配置', + 'notes配置', + '侧边栏配置', + ], + }, + { + text: 'frontmatter', + prefix: 'frontmatter', + collapsed: false, + items: [ + 'basic', + 'home', + 'post', + 'friend', + ], + }, + { + text: '内置插件', + prefix: 'plugins', + collapsed: false, + items: [ + '', + '代码高亮', + '搜索', + '阅读统计', + 'markdown增强', + 'markdownPower', + '百度统计', + '水印', + ], + }, + ], +}) diff --git a/docs/.vuepress/notes/zh/theme-guide.ts b/docs/.vuepress/notes/zh/theme-guide.ts new file mode 100644 index 00000000..beab6f91 --- /dev/null +++ b/docs/.vuepress/notes/zh/theme-guide.ts @@ -0,0 +1,147 @@ +import { defineNoteConfig } from 'vuepress-theme-plume' + +export const themeGuide = defineNoteConfig({ + dir: 'theme/guide', + link: '/guide/', + sidebar: [ + { + text: '快速开始', + collapsed: false, + icon: 'carbon:idea', + items: [ + '介绍', + '安装与使用', + '博客', + '知识笔记', + '编写文章', + '国际化', + '部署', + ], + }, + { + text: '写作', + icon: 'fluent-mdl2:edit-create', + collapsed: false, + items: [ + { + text: 'markdown', + icon: 'material-symbols:markdown-outline', + prefix: 'markdown', + collapsed: true, + items: [ + '基础', + '扩展', + '进阶', + ], + }, + { + text: '代码块', + prefix: '代码', + icon: 'ph:code-bold', + collapsed: true, + items: [ + '介绍', + '特性支持', + '代码组', + '导入代码', + 'twoslash', + ], + }, + { + text: '代码演示', + prefix: '代码演示', + icon: 'carbon:demo', + collapsed: true, + items: [ + '前端', + 'rust', + 'golang', + 'kotlin', + 'codepen', + 'jsFiddle', + 'codeSandbox', + 'replit', + ], + }, + { + text: '图表', + icon: 'mdi:chart-line', + prefix: '图表', + collapsed: true, + items: [ + 'chart', + 'echarts', + 'mermaid', + 'flowchart', + ], + }, + { + text: '资源嵌入', + icon: 'dashicons:embed-video', + prefix: '嵌入', + collapsed: true, + items: [ + 'pdf', + 'bilibili', + 'youtube', + ], + }, + ], + }, + { + text: '功能', + icon: 'lucide:box', + collapsed: false, + prefix: '功能', + items: [ + '图标', + '代码复制', + '内容搜索', + '评论', + '加密', + '文章水印', + '友情链接页', + 'seo', + 'sitemap', + ], + }, + { + text: '组件', + prefix: '组件', + icon: 'uiw:component', + collapsed: false, + items: [ + '徽章', + '图标', + '隐秘文本', + '卡片', + '链接卡片', + '图片卡片', + '卡片容器', + '首页布局容器', + 'repoCard', + 'npmBadge', + ], + }, + { + text: '自定义', + icon: 'material-symbols:dashboard-customize-outline-rounded', + collapsed: false, + items: [ + '自定义首页', + '自定义样式', + '布局插槽', + '组件覆写', + ], + }, + { + text: 'API', + icon: 'mdi:api', + collapsed: false, + items: [ + 'api-客户端', + 'api-node', + ], + }, + ], +}) diff --git a/docs/.vuepress/notes/zh/tools.ts b/docs/.vuepress/notes/zh/tools.ts new file mode 100644 index 00000000..769c3d61 --- /dev/null +++ b/docs/.vuepress/notes/zh/tools.ts @@ -0,0 +1,17 @@ +import { defineNoteConfig } from 'vuepress-theme-plume' + +export const tools = defineNoteConfig({ + dir: 'tools', + link: '/tools/', + sidebar: [ + { + text: '工具', + icon: 'tabler:tools', + items: [ + 'custom-theme', + 'home-hero-tint-plate', + 'caniuse', + ], + }, + ], +}) diff --git a/docs/.vuepress/plume.config.ts b/docs/.vuepress/plume.config.ts index 6464a896..c835f5e7 100644 --- a/docs/.vuepress/plume.config.ts +++ b/docs/.vuepress/plume.config.ts @@ -1,5 +1,5 @@ import { defineThemeConfig } from 'vuepress-theme-plume' -import { enNotes, zhNotes } from './notes.js' +import { enNotes, zhNotes } from './notes/index.js' import { enNavbar, zhNavbar } from './navbar.js' export default defineThemeConfig({ diff --git a/docs/.vuepress/theme.ts b/docs/.vuepress/theme.ts index 888bd636..ad061289 100644 --- a/docs/.vuepress/theme.ts +++ b/docs/.vuepress/theme.ts @@ -6,7 +6,7 @@ export const theme: Theme = plumeTheme({ hostname: process.env.SITE_HOST || 'https://plume.pengzhanbo.cn', plugins: { - shiki: { twoslash: true }, + shiki: { twoslash: true, lineNumbers: 10 }, markdownEnhance: { demo: true, diff --git a/docs/notes/theme/guide/组件/卡片.md b/docs/notes/theme/guide/组件/卡片.md index c07992ef..327bf06b 100644 --- a/docs/notes/theme/guide/组件/卡片.md +++ b/docs/notes/theme/guide/组件/卡片.md @@ -55,3 +55,8 @@ permalink: /guide/components/cark/ 这里是卡片内容。 + +:::info +在插槽内也可以使用 markdown 语法,但需要注意的是,markdown 语法需要与 标签之间间隔一行。 +否则将被识别为普通文本。 +::: diff --git a/docs/notes/theme/guide/组件/链接卡片.md b/docs/notes/theme/guide/组件/链接卡片.md index 78e0c017..3a8679c0 100644 --- a/docs/notes/theme/guide/组件/链接卡片.md +++ b/docs/notes/theme/guide/组件/链接卡片.md @@ -39,3 +39,48 @@ permalink: /guide/components/link-card/ + +使用组件插槽,可以实现更丰富的表现。 + +**输入:** + +```md :no-line-numbers + + + - 这里是卡片内容 + - 这里是卡片内容 + + + + + + + - 这里是卡片内容 + - 这里是卡片内容 + + +``` + +**输出:** + + +- 这里是卡片内容 +- 这里是卡片内容 + + + + + + +- 这里是卡片内容 +- 这里是卡片内容 + + +:::info +在插槽内也可以使用 markdown 语法,但需要注意的是,markdown 语法需要与 标签之间间隔一行。 +否则将被识别为普通文本。 +::: diff --git a/plugins/plugin-md-power/package.json b/plugins/plugin-md-power/package.json index baf569eb..3cf40dfb 100644 --- a/plugins/plugin-md-power/package.json +++ b/plugins/plugin-md-power/package.json @@ -45,7 +45,7 @@ "markdown-it-container": "^4.0.0", "nanoid": "^5.0.7", "shiki": "^1.14.1", - "tm-grammars": "^1.17.4", + "tm-grammars": "^1.17.8", "tm-themes": "^1.8.1", "vue": "^3.4.38" }, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ba9256b9..5fb72cf9 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -166,8 +166,8 @@ importers: specifier: ^1.14.1 version: 1.14.1 tm-grammars: - specifier: ^1.17.4 - version: 1.17.4 + specifier: ^1.17.8 + version: 1.17.8 tm-themes: specifier: ^1.8.1 version: 1.8.1 @@ -403,9 +403,6 @@ packages: peerDependencies: '@algolia/client-search': '>= 4.9.1 < 6' algoliasearch: '>= 4.9.1 < 6' - peerDependenciesMeta: - '@algolia/client-search': - optional: true '@algolia/cache-browser-local-storage@4.20.0': resolution: {integrity: sha512-uujahcBt4DxduBTvYdwO3sBfHuJvJokiC3BP1+O70fglmE1ShkH8lpXqZBac1rrU3FnNYSUs4pL9lBdTKeRPOQ==} @@ -5369,8 +5366,8 @@ packages: tinyexec@0.2.0: resolution: {integrity: sha512-au8dwv4xKSDR+Fw52csDo3wcDztPdne2oM1o/7LFro4h6bdFmvyUAeAfX40pwDtzHgRFqz1XWaUqgKS2G83/ig==} - tm-grammars@1.17.4: - resolution: {integrity: sha512-FuZ+f/pwYcKy4Ci56r75d4mRLBsdLUJunIgF+1u5Oy0co9laQqZFH1rss+F6/vdx1vJljPubZj9clKxrwTKg0A==} + tm-grammars@1.17.8: + resolution: {integrity: sha512-Qw67JNutL9LCt8FFw5RfsogeQ40iSeqrTHDSp0ecnY/b+ZweK8izlw6y/ZMje2+I6DMtTiBOCgmXEf+2oH11jQ==} tm-themes@1.8.1: resolution: {integrity: sha512-jTUfDRn5TysYhkxxEWBQDo1C1n4yoHcnfNNqXkVxIMGQCgal/9poGuMBsfbnZCPEmFVcN2rtrUwaOJ8s2hVQXg==} @@ -5907,9 +5904,8 @@ snapshots: '@algolia/autocomplete-shared@1.9.3(@algolia/client-search@4.20.0)(algoliasearch@4.20.0)': dependencies: - algoliasearch: 4.20.0 - optionalDependencies: '@algolia/client-search': 4.20.0 + algoliasearch: 4.20.0 '@algolia/cache-browser-local-storage@4.20.0': dependencies: @@ -11462,7 +11458,7 @@ snapshots: tinyexec@0.2.0: {} - tm-grammars@1.17.4: {} + tm-grammars@1.17.8: {} tm-themes@1.8.1: {} diff --git a/theme/src/client/components/Blog/VPBlogArchives.vue b/theme/src/client/components/Blog/VPBlogArchives.vue index 8b11ef5d..f78058af 100644 --- a/theme/src/client/components/Blog/VPBlogArchives.vue +++ b/theme/src/client/components/Blog/VPBlogArchives.vue @@ -1,8 +1,8 @@ @@ -12,7 +12,7 @@ const { archives } = useArchives()

- {{ title }} + {{ archiveLink.text }}