Skip to content

Commit

Permalink
Merge pull request #128 from pengzhanbo/RC-82
Browse files Browse the repository at this point in the history
RC 82
  • Loading branch information
pengzhanbo authored Jul 23, 2024
2 parents 8b657c3 + 8e1d931 commit e690d48
Show file tree
Hide file tree
Showing 53 changed files with 648 additions and 601 deletions.
10 changes: 8 additions & 2 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,19 @@
"name": "dev",
"request": "launch",
"type": "node-terminal",
"command": "pnpm run dev"
"command": "pnpm dev"
},
{
"name": "build",
"request": "launch",
"type": "node-terminal",
"command": "pnpm build"
},
{
"name": "docs:dev",
"type": "node-terminal",
"request": "launch",
"command": "pnpm run docs:dev"
"command": "pnpm docs:dev"
},
{
"name": "docs:build",
Expand Down
2 changes: 1 addition & 1 deletion docs/.vuepress/notes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export const zhNotes = definePlumeNotesConfig({
icon: 'lucide:box',
collapsed: false,
dir: '功能',
items: ['代码复制', '内容搜索', '评论', '加密', '组件', '文章水印', '友情链接页', 'seo', 'sitemap'],
items: ['图标', '代码复制', '内容搜索', '评论', '加密', '组件', '文章水印', '友情链接页', 'seo', 'sitemap'],
},
{
text: '自定义',
Expand Down
36 changes: 3 additions & 33 deletions docs/notes/theme/config/plugins/百度统计.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,37 +6,7 @@ permalink: /config/plugins/baidu-tongji/
---

::: caution
主题计划在 未来的版本中 从内置插件中移除此插件。
:::

## 概述

为站点添加 百度统计。该插件默认不启用。

关联插件: [@vuepress-plume/plugin-baidu-tongji](https://github.com/pengzhanbo/vuepress-theme-plume/tree/main/plugins/plugin-baidu-tongji)

## 配置

### key
此插件已从主题内置插件中移除。

- 类型:`string`
- 默认值:`''`

配置百度统计的key

### 启用

```ts{7-9}
import { plumeTheme } from 'vuepress-theme-plume'
import { defineUserConfig } from 'vuepress'
export default defineUserConfig({
theme: plumeTheme({
plugins: {
baiduTongji: {
key: '你的百度统计key'
}
}
}),
})
```
如需使用相关功能,请使用 [@vuepress/plugin-baidu-analytics](https://ecosystem.vuejs.press/zh/plugins/analytics/baidu-analytics.html) 代替。
:::
20 changes: 20 additions & 0 deletions docs/notes/theme/config/主题配置.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,26 @@ interface BlogOptions {
}
```

### cache

- 类型: `false | 'memory' | 'filesystem'`
- 默认值: `filesystem`
- 详情:

是否启用 编译缓存,或配置缓存方式

此配置项用于解决 VuePress 启动速度慢的问题,在首次启动服务时,对编译结果进行缓存,二次启动时
直接读取缓存,跳过编译,从而加快启动速度。

- `false`:禁用 缓存
- `'memory'`:使用内存缓存,此方式可获得更快的启动速度,但随着项目文件数量增加,内存占用会增加,
适合文章数量较少的项目使用
- `'filesystem'`:使用文件系统缓存,此方式可获得相对快且稳定的启动速度,更适合内容多的项目使用

::: warning
该字段不支持在 [主题配置文件 `plume.config.js`](./配置说明.md#主题配置文件) 中进行配置。
:::

### locales

- 类型: `Record<string, PlumeThemeLocaleConfig>`
Expand Down
11 changes: 7 additions & 4 deletions docs/notes/theme/guide/markdown/进阶.md
Original file line number Diff line number Diff line change
Expand Up @@ -446,11 +446,10 @@ interface PlotOptions {

## iconify 图标

Markdown 文件中使用 [iconify](https://iconify.design/) 的图标。 主题虽然提供了
[`<Iconify />`](/guide/features/component/#iconify) 组件来支持在 markdown 中使用图标,
但是它需要从远程加载图标,可能速度比较慢。
Markdown 文件中使用 [iconify](https://iconify.design/) 的图标。 主题一方面提供了
[`<Icon />`](../功能/组件.md#图标) 组件来支持在 markdown 中使用图标,

为此,主题提供了另一种可选的方式,以更简单的方式,在 Markdown 中使用图标,并且将 图标资源编译到
一方面,主题还提供了另一种可选的方式,以更简单的方式,在 Markdown 中使用图标,并且将 图标资源编译到
本地静态资源中。

### 配置
Expand Down Expand Up @@ -537,6 +536,8 @@ github: :[tdesign:logo-github-filled]:
修改颜色::[tdesign:logo-github-filled /#f00]:
修改大小::[tdesign:logo-github-filled 36px]:
修改大小颜色::[tdesign:logo-github-filled 36px/#f00]:
彩色图标 :[skill-icons:vscode-dark 36px]:
```

输出:
Expand All @@ -546,6 +547,8 @@ github: :[tdesign:logo-github-filled]:
修改大小::[tdesign:logo-github-filled 36px]:
修改大小颜色::[tdesign:logo-github-filled 36px/#f00]:

彩色图标 :[skill-icons:vscode-dark 36px]:

## can I use

此功能默认不启用,你可以在配置文件中启用它。
Expand Down
85 changes: 85 additions & 0 deletions docs/notes/theme/guide/功能/图标.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
---
title: 图标
icon: raphael:smile2
author: pengzhanbo
createTime: 2024/07/22 10:45:47
permalink: /guide/features/icon/
---

## 概述

主题支持 [iconify](https://icon-sets.iconify.design/) 的所有图标,并提供了不同的方式来使用它们。

## 组件

通过 `<Icon />` 组件来使用图标。

你可以在 markdown 文件中使用该 组件。

### 属性

`<Icon />` 组件接受一个 `name` 属性,用于指定图标的名称。还支持传入 `color``size` 属性来设置图标的颜色和大小。
但对于 彩色图标,`color` 属性设置无效。

| 属性 | 类型 | 描述 |
| ----- | ------------------ | -------------------------------------------------------------------------- |
| name | `string` | 图标名称,在 [iconify](https://icon-sets.iconify.design/) 可获取对应的名称 |
| color | `string` | 图标颜色,仅纯色图标支持设置颜色 |
| size | `number \| string` | 设置图标大小,默认单位为 `px` ,可自定义单位 |

**示例:**

````md
- 纯色图标:<Icon name="octicon:smiley-16" />
- 定义纯色图标的颜色和大小:<Icon name="octicon:smiley-16" color="red" size="2em" />
- 彩色图标:<Icon name="noto:smiling-face-with-open-hands" />
- 定义彩色图标的大小:<Icon name="noto:smiling-face-with-open-hands" size="2em" />
````

- 纯色图标:<Icon name="octicon:smiley-16" />
- 定义纯色图标的颜色和大小:<Icon name="octicon:smiley-16" color="red" size="2em" />
- 彩色图标:<Icon name="noto:smiling-face-with-open-hands" />
- 定义彩色图标的大小:<Icon name="noto:smiling-face-with-open-hands" size="2em" />

### 加载图标

`<Icon />` 组件默认通过 远程请求 `CDN` 获取图标资源,但这可能受到网络环境的影响,出现加载失败
或者延迟显示的情况。

为了解决这一问题,主题建议 在你的站点项目中安装 `@iconify/json` 包。
主题会检查当前项目是否安装了 `@iconify/json`,如果安装了该包,则主题自动解析所使用到的图标,
并处理为本地图标资源,在构建时打包到 `dist` 目录中。

由于 `@iconify/json` 包比较大,需要手动进行安装:

::: code-tabs
@tab pnpm

```sh
pnpm add @iconify/json
```

@tab yarn

```sh
yarn add @iconify/json
```

@tab npm

```sh
npm install @iconify/json
```

:::

## markdown 语法糖

相关内容请查看 [iconify-图标 语法糖](../markdown/进阶.md#iconify-图标)

---

::: tip 说明
[navbar](../../config/主题配置.md#navbar) 配置和 [notes](../../config/主题配置.md#notes) 配置
中的 `icon` 选项,也支持传入 iconify 图标名,并且当安装了 `@iconify/json`,也会自动解析为本地图标资源。
:::
1 change: 1 addition & 0 deletions plugins/plugin-content-update/tsup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export default defineConfig(() => {
...DEFAULT_OPTIONS,
entry: ['./src/client/config.ts'],
outDir: './lib/client',
dts: false,
external: [...clientExternal, './components/Content.js'],
},
// client/index.js
Expand Down
1 change: 1 addition & 0 deletions plugins/plugin-fonts/tsup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export default defineConfig(() => {
...DEFAULT_OPTIONS,
entry: ['./src/client/config.ts'],
outDir: './lib/client',
dts: false,
external: clientExternal,
},
]
Expand Down
21 changes: 0 additions & 21 deletions plugins/plugin-iconify/LICENSE

This file was deleted.

47 changes: 0 additions & 47 deletions plugins/plugin-iconify/README.md

This file was deleted.

51 changes: 0 additions & 51 deletions plugins/plugin-iconify/package.json

This file was deleted.

Loading

0 comments on commit e690d48

Please sign in to comment.