commit
cc72019e2b
@ -17,9 +17,9 @@
|
||||
"anywhere": "^1.6.0",
|
||||
"katex": "^0.16.9",
|
||||
"leancloud-storage": "^4.15.2",
|
||||
"sass": "^1.69.5",
|
||||
"sass": "^1.69.6",
|
||||
"sass-loader": "^13.3.3",
|
||||
"vue": "^3.3.13",
|
||||
"vue": "^3.4.3",
|
||||
"vuepress-theme-plume": "workspace:*"
|
||||
}
|
||||
}
|
||||
|
||||
@ -14,7 +14,7 @@
|
||||
"vuepress-theme-plume"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=16",
|
||||
"node": "^18 || >=20.0.0",
|
||||
"pnpm": ">=7"
|
||||
},
|
||||
"scripts": {
|
||||
@ -40,7 +40,7 @@
|
||||
"devDependencies": {
|
||||
"@commitlint/cli": "^18.4.3",
|
||||
"@commitlint/config-conventional": "^18.4.3",
|
||||
"@pengzhanbo/eslint-config-vue": "^1.4.0",
|
||||
"@pengzhanbo/eslint-config-vue": "^1.5.0",
|
||||
"@types/minimist": "^1.2.5",
|
||||
"@types/node": "20.9.1",
|
||||
"@types/webpack-env": "^1.18.4",
|
||||
@ -49,7 +49,7 @@
|
||||
"commitizen": "^4.3.0",
|
||||
"concurrently": "^8.2.2",
|
||||
"conventional-changelog-cli": "^4.1.0",
|
||||
"cpx2": "^7.0.0",
|
||||
"cpx2": "^7.0.1",
|
||||
"cross-env": "^7.0.3",
|
||||
"cz-conventional-changelog": "^3.3.0",
|
||||
"eslint": "^8.56.0",
|
||||
|
||||
@ -3,13 +3,19 @@
|
||||
自动生成 `*.md` 文件的 `frontmatter` 配置。
|
||||
|
||||
## Install
|
||||
```
|
||||
|
||||
```sh
|
||||
npm install @vuepress-plume/plugin-auto-frontmatter
|
||||
# or
|
||||
pnpm add @vuepress-plume/plugin-auto-frontmatter
|
||||
# or
|
||||
yarn add @vuepress-plume/plugin-auto-frontmatter
|
||||
```
|
||||
## Usage
|
||||
``` js
|
||||
// .vuepress/config.js
|
||||
// .vuepress/config.[jt]s
|
||||
import { autoFrontmatterPlugin } from '@vuepress-plume/plugin-auto-frontmatter'
|
||||
|
||||
export default {
|
||||
// ...
|
||||
plugins: [
|
||||
|
||||
@ -14,7 +14,10 @@
|
||||
"url": "https://github.com/pengzhanbo/vuepress-theme-plume/issues"
|
||||
},
|
||||
"exports": {
|
||||
".": "./lib/node/index.js",
|
||||
".": {
|
||||
"types": "./lib/node/index.d.ts",
|
||||
"import": "./lib/node/index.js"
|
||||
},
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"main": "lib/node/index.js",
|
||||
|
||||
@ -3,14 +3,20 @@
|
||||
在vuepress中接入百度统计
|
||||
|
||||
## Install
|
||||
```
|
||||
|
||||
```sh
|
||||
npm install @vuepress-plume/plugin-baidu-tongji
|
||||
# or
|
||||
pnpm add @vuepress-plume/plugin-baidu-tongji
|
||||
# or
|
||||
yarn add @vuepress-plume/plugin-baidu-tongji
|
||||
```
|
||||
## Usage
|
||||
``` js
|
||||
// .vuepress/config.js
|
||||
const { baiduTongjiPlugin } = require('@vuepress-plume/plugin-baidu-tongji')
|
||||
module.exports = {
|
||||
// .vuepress/config.[jt]s
|
||||
import { baiduTongjiPlugin } from '@vuepress-plume/plugin-baidu-tongji'
|
||||
|
||||
export default {
|
||||
// ...
|
||||
plugins: [
|
||||
baiduTongjiPlugin({
|
||||
|
||||
@ -14,7 +14,10 @@
|
||||
"url": "https://github.com/pengzhanbo/vuepress-theme-plume/issues"
|
||||
},
|
||||
"exports": {
|
||||
".": "./lib/node/index.js",
|
||||
".": {
|
||||
"types": "./lib/node/index.d.ts",
|
||||
"import": "./lib/node/index.js"
|
||||
},
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"main": "lib/node/index.js",
|
||||
@ -29,10 +32,7 @@
|
||||
"ts": "tsc -b tsconfig.build.json"
|
||||
},
|
||||
"dependencies": {
|
||||
"@vuepress/client": "2.0.0-rc.0",
|
||||
"@vuepress/core": "2.0.0-rc.0",
|
||||
"@vuepress/shared": "2.0.0-rc.0",
|
||||
"@vuepress/utils": "2.0.0-rc.0"
|
||||
"@vuepress/core": "2.0.0-rc.0"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
@ -41,6 +41,6 @@
|
||||
"VuePress",
|
||||
"vuepress plugin",
|
||||
"baiduTongji",
|
||||
"vuepress-plugin-plugin-baidu-tongji"
|
||||
"vuepress-plugin-baidu-tongji"
|
||||
]
|
||||
}
|
||||
|
||||
@ -8,12 +8,10 @@ export function baiduTongjiPlugin({ key = '' }: BaiduTongjiOptions): Plugin {
|
||||
return {
|
||||
name: '@vuepress-plume/plugin-baidu-tongji',
|
||||
extendsPage: (page) => {
|
||||
page.frontmatter.head = page.frontmatter.head || []
|
||||
page.frontmatter.head ??= []
|
||||
page.frontmatter.head?.push([
|
||||
'script',
|
||||
{
|
||||
type: 'text/javascript',
|
||||
},
|
||||
{ type: 'text/javascript' },
|
||||
'var _hmt = _hmt || []',
|
||||
])
|
||||
page.frontmatter.head?.push([
|
||||
|
||||
@ -1,14 +1,22 @@
|
||||
# `@vuepress-plume/plugin-blog-data`
|
||||
|
||||
## Install
|
||||
```
|
||||
|
||||
```sh
|
||||
npm install @vuepress-plume/plugin-blog-data
|
||||
# or
|
||||
pnpm add @vuepress-plume/plugin-blog-data
|
||||
# or
|
||||
yarn add @vuepress-plume/plugin-blog-data
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
``` js
|
||||
// .vuepress/config.js
|
||||
const { blogDataPlugin } = require('@vuepress-plume/plugin-blog-data')
|
||||
module.exports = {
|
||||
// .vuepress/config.[jt]s
|
||||
import { blogDataPlugin } from '@vuepress-plume/plugin-blog-data'
|
||||
|
||||
export default {
|
||||
// ...
|
||||
plugins: [
|
||||
blogDataPlugin()
|
||||
|
||||
@ -14,8 +14,14 @@
|
||||
"url": "https://github.com/pengzhanbo/vuepress-theme-plume/issues"
|
||||
},
|
||||
"exports": {
|
||||
".": "./lib/node/index.js",
|
||||
"./client": "./lib/client/index.js",
|
||||
".": {
|
||||
"types": "./lib/node/index.d.ts",
|
||||
"import": "./lib/node/index.js"
|
||||
},
|
||||
"./client": {
|
||||
"types": "./lib/client/index.d.ts",
|
||||
"import": "./lib/client/index.js"
|
||||
},
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"main": "lib/node/index.js",
|
||||
@ -33,11 +39,10 @@
|
||||
"@vue/devtools-api": "^6.5.1",
|
||||
"@vuepress/client": "2.0.0-rc.0",
|
||||
"@vuepress/core": "2.0.0-rc.0",
|
||||
"@vuepress/shared": "2.0.0-rc.0",
|
||||
"@vuepress/utils": "2.0.0-rc.0",
|
||||
"chokidar": "^3.5.3",
|
||||
"create-filter": "^1.0.1",
|
||||
"vue": "^3.3.13"
|
||||
"vue": "^3.4.3"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
|
||||
@ -8,23 +8,32 @@ VuePress 2 插件
|
||||
|
||||
## Install
|
||||
``` sh
|
||||
npm install @vuepress-plume/plugin-caniuse
|
||||
# or
|
||||
pnpm add @vuepress-plume/plugin-caniuse
|
||||
# or
|
||||
yarn add @vuepress-plume/plugin-caniuse
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
### 在VuePress 配置文件中添加插件
|
||||
|
||||
``` js
|
||||
// .vuepress/config.js
|
||||
// .vuepress/config.[jt]s
|
||||
import { caniusePlugin } from '@vuepress-plume/plugin-caniuse'
|
||||
|
||||
export default {
|
||||
// ...
|
||||
plugins: [
|
||||
['@vuepress-plume/plugin-caniuse', { mode: 'image' }]
|
||||
caniusePlugin({ mode: 'image' }),
|
||||
]
|
||||
// ...
|
||||
}
|
||||
```
|
||||
|
||||
### 在markdown中编写
|
||||
|
||||
``` md
|
||||
::: caniuse <feature> {{browser_versions}}
|
||||
:::
|
||||
@ -51,6 +60,7 @@ export default {
|
||||
- 大于`0` 表示高于当前浏览器版本的支持情况
|
||||
|
||||
## Example
|
||||
|
||||
``` md
|
||||
::: caniuse css-matches-pseudo {-2,-1,1}
|
||||
:::
|
||||
|
||||
@ -21,8 +21,14 @@
|
||||
"caniuse"
|
||||
],
|
||||
"exports": {
|
||||
".": "./lib/node/index.js",
|
||||
"./client": "./lib/client/index.js",
|
||||
".": {
|
||||
"types": "./lib/node/index.d.ts",
|
||||
"import": "./lib/node/index.js"
|
||||
},
|
||||
"./client": {
|
||||
"types": "./lib/client/index.d.ts",
|
||||
"import": "./lib/client/index.js"
|
||||
},
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"main": "lib/node/index.js",
|
||||
@ -36,13 +42,14 @@
|
||||
"ts": "tsc -b tsconfig.build.json"
|
||||
},
|
||||
"dependencies": {
|
||||
"@types/markdown-it": "^13.0.7",
|
||||
"@vuepress/cli": "2.0.0-rc.0",
|
||||
"@vuepress/client": "2.0.0-rc.0",
|
||||
"@vuepress/core": "2.0.0-rc.0",
|
||||
"@vuepress/utils": "2.0.0-rc.0",
|
||||
"markdown-it-container": "^4.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/markdown-it": "^13.0.7"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
}
|
||||
|
||||
@ -4,14 +4,20 @@
|
||||
实现当页面内容发生更新时,触发 `onContentUpdated` 事件。
|
||||
|
||||
## Install
|
||||
```
|
||||
|
||||
```sh
|
||||
npm install @vuepress-plume/plugin-content-update
|
||||
# or
|
||||
pnpm add @vuepress-plume/plugin-content-update
|
||||
# or
|
||||
yarn add @vuepress-plume/plugin-content-update
|
||||
```
|
||||
## Usage
|
||||
``` js
|
||||
// .vuepress/config.js
|
||||
const { contentUpdatePlugin } = require('@vuepress-plume/plugin-content-update')
|
||||
module.exports = {
|
||||
// .vuepress/config.[jt]s
|
||||
import { contentUpdatePlugin } from '@vuepress-plume/plugin-content-update'
|
||||
|
||||
export default {
|
||||
// ...
|
||||
plugins: [
|
||||
contentUpdatePlugin()
|
||||
|
||||
@ -14,8 +14,14 @@
|
||||
"url": "https://github.com/pengzhanbo/vuepress-theme-plume/issues"
|
||||
},
|
||||
"exports": {
|
||||
".": "./lib/node/index.js",
|
||||
"./client": "./lib/client/index.js",
|
||||
".": {
|
||||
"types": "./lib/node/index.d.ts",
|
||||
"import": "./lib/node/index.js"
|
||||
},
|
||||
"./client": {
|
||||
"types": "./lib/client/index.d.ts",
|
||||
"import": "./lib/client/index.js"
|
||||
},
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"main": "lib/node/index.js",
|
||||
@ -32,9 +38,8 @@
|
||||
"dependencies": {
|
||||
"@vuepress/client": "2.0.0-rc.0",
|
||||
"@vuepress/core": "2.0.0-rc.0",
|
||||
"@vuepress/shared": "2.0.0-rc.0",
|
||||
"@vuepress/utils": "2.0.0-rc.0",
|
||||
"vue": "^3.3.13",
|
||||
"vue": "^3.4.3",
|
||||
"vue-router": "4.2.5"
|
||||
},
|
||||
"publishConfig": {
|
||||
|
||||
@ -1,14 +1,20 @@
|
||||
# `@vuepress-plume/plugin-copy-code`
|
||||
|
||||
## Install
|
||||
```
|
||||
|
||||
```sh
|
||||
npm install @vuepress-plume/plugin-copy-code
|
||||
# or
|
||||
pnpm add @vuepress-plume/plugin-copy-code
|
||||
# or
|
||||
yarn add @vuepress-plume/plugin-copy-code
|
||||
```
|
||||
## Usage
|
||||
``` js
|
||||
// .vuepress/config.js
|
||||
const { copyCodePlugin } = require('@vuepress-plume/plugin-copy-code')
|
||||
module.exports = {
|
||||
import { copyCodePlugin } from '@vuepress-plume/plugin-copy-code'
|
||||
|
||||
export default {
|
||||
// ...
|
||||
plugins: [
|
||||
copyCodePlugin()
|
||||
|
||||
@ -14,8 +14,14 @@
|
||||
"url": "https://github.com/pengzhanbo/vuepress-theme-plume/issues"
|
||||
},
|
||||
"exports": {
|
||||
".": "./lib/node/index.js",
|
||||
"./client": "./lib/client/index.js",
|
||||
".": {
|
||||
"types": "./lib/node/index.d.ts",
|
||||
"import": "./lib/node/index.js"
|
||||
},
|
||||
"./client": {
|
||||
"types": "./lib/client/index.d.ts",
|
||||
"import": "./lib/client/index.js"
|
||||
},
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"main": "lib/node/index.js",
|
||||
@ -35,7 +41,7 @@
|
||||
"@vuepress/core": "2.0.0-rc.0",
|
||||
"@vuepress/shared": "2.0.0-rc.0",
|
||||
"@vuepress/utils": "2.0.0-rc.0",
|
||||
"vue": "^3.3.13"
|
||||
"vue": "^3.4.3"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
|
||||
@ -3,14 +3,20 @@
|
||||
添加 `iconify` 图标库支持。并注入全局组件 `<Iconify>`
|
||||
|
||||
## Install
|
||||
```
|
||||
|
||||
```sh
|
||||
npm install @vuepress-plume/plugin-iconify
|
||||
# or
|
||||
pnpm add @vuepress-plume/plugin-iconify
|
||||
# or
|
||||
yarn add @vuepress-plume/plugin-iconify
|
||||
```
|
||||
## Usage
|
||||
``` js
|
||||
// .vuepress/config.js
|
||||
const iconifyPlugin = require('@vuepress-plume/plugin-iconify')
|
||||
module.exports = {
|
||||
// .vuepress/config.[jt]s
|
||||
import { iconifyPlugin } from '@vuepress-plume/plugin-iconify'
|
||||
|
||||
export default {
|
||||
// ...
|
||||
plugins: [
|
||||
iconifyPlugin()
|
||||
|
||||
@ -14,8 +14,14 @@
|
||||
"url": "https://github.com/pengzhanbo/vuepress-theme-plume/issues"
|
||||
},
|
||||
"exports": {
|
||||
".": "./lib/node/index.js",
|
||||
"./client": "./lib/client/index.js",
|
||||
".": {
|
||||
"types": "./lib/node/index.d.ts",
|
||||
"import": "./lib/node/index.js"
|
||||
},
|
||||
"./client": {
|
||||
"types": "./lib/client/index.d.ts",
|
||||
"import": "./lib/client/index.js"
|
||||
},
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"main": "lib/node/index.js",
|
||||
@ -38,7 +44,7 @@
|
||||
"@vuepress/core": "2.0.0-rc.0",
|
||||
"@vuepress/shared": "2.0.0-rc.0",
|
||||
"@vuepress/utils": "2.0.0-rc.0",
|
||||
"vue": "^3.3.13"
|
||||
"vue": "^3.4.3"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
|
||||
@ -22,7 +22,12 @@ You may need this plugin to provide support.
|
||||
- 使用 `dotenv` 在本地服务环境提供 类似于 `netlify environment variables` 支持。 在项目根目录下 创建 `.env` 文件用于保存开发时环境变量
|
||||
|
||||
## Install
|
||||
```
|
||||
|
||||
```sh
|
||||
npm install vuepress-plugin-netlify-functions
|
||||
# or
|
||||
pnpm add vuepress-plugin-netlify-functions
|
||||
# or
|
||||
yarn add vuepress-plugin-netlify-functions
|
||||
```
|
||||
## Usage
|
||||
@ -31,9 +36,10 @@ yarn add vuepress-plugin-netlify-functions
|
||||
|
||||
在 vuepress 项目中,或者在一个 vuepress 主题中
|
||||
``` js
|
||||
// .vuepress/config.js
|
||||
// .vuepress/config.[jt]s
|
||||
import { netlifyFunctionsPlugin } from 'vuepress-plugin-netlify-functions'
|
||||
module.exports = {
|
||||
|
||||
export default {
|
||||
// ...
|
||||
plugins: [
|
||||
netlifyFunctionsPlugin()
|
||||
|
||||
@ -22,7 +22,10 @@
|
||||
"vuepress-plugin-netlify-functions"
|
||||
],
|
||||
"exports": {
|
||||
".": "./lib/node/index.js",
|
||||
".": {
|
||||
"types": "./lib/node/index.d.ts",
|
||||
"import": "./lib/node/index.js"
|
||||
},
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"main": "lib/node/index.js",
|
||||
@ -44,15 +47,15 @@
|
||||
"@vuepress/utils": "2.0.0-rc.0",
|
||||
"chalk": "^5.3.0",
|
||||
"chokidar": "^3.5.3",
|
||||
"cpx2": "^7.0.0",
|
||||
"cpx2": "^7.0.1",
|
||||
"dotenv": "^16.3.1",
|
||||
"esbuild": "^0.19.10",
|
||||
"esbuild": "^0.19.11",
|
||||
"execa": "^8.0.1",
|
||||
"netlify-cli": "^17.10.1",
|
||||
"netlify-cli": "^17.10.2",
|
||||
"portfinder": "^1.0.32"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^20.10.5"
|
||||
"@types/node": "^20.10.6"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
|
||||
@ -1,14 +1,21 @@
|
||||
# `@vuepress-plume/plugin-notes-data`
|
||||
|
||||
## Install
|
||||
```
|
||||
|
||||
```sh
|
||||
npm install @vuepress-plume/plugin-notes-data
|
||||
# or
|
||||
pnpm add @vuepress-plume/plugin-notes-data
|
||||
# or
|
||||
yarn add @vuepress-plume/plugin-notes-data
|
||||
```
|
||||
## Usage
|
||||
|
||||
``` js
|
||||
// .vuepress/config.js
|
||||
const notesDataPlugin = require('@vuepress-plume/plugin-notes-data')
|
||||
module.exports = {
|
||||
// .vuepress/config.[jt]s
|
||||
import { notesDataPlugin } from '@vuepress-plume/plugin-notes-data'
|
||||
|
||||
export default {
|
||||
// ...
|
||||
plugins: [
|
||||
notesDataPlugin()
|
||||
|
||||
@ -14,8 +14,14 @@
|
||||
"url": "https://github.com/pengzhanbo/vuepress-theme-plume/issues"
|
||||
},
|
||||
"exports": {
|
||||
".": "./lib/node/index.js",
|
||||
"./client": "./lib/client/index.js",
|
||||
".": {
|
||||
"types": "./lib/node/index.d.ts",
|
||||
"import": "./lib/node/index.js"
|
||||
},
|
||||
"./client": {
|
||||
"types": "./lib/client/index.d.ts",
|
||||
"import": "./lib/client/index.js"
|
||||
},
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"main": "lib/node/index.js",
|
||||
@ -40,7 +46,7 @@
|
||||
"@vuepress/utils": "2.0.0-rc.0",
|
||||
"chokidar": "^3.5.3",
|
||||
"create-filter": "^1.0.1",
|
||||
"vue": "^3.3.13"
|
||||
"vue": "^3.4.3"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
|
||||
@ -37,7 +37,7 @@
|
||||
"@vuepress/shared": "2.0.0-rc.0",
|
||||
"@vuepress/utils": "2.0.0-rc.0",
|
||||
"leancloud-storage": "^4.15.2",
|
||||
"vue": "^3.3.13",
|
||||
"vue": "^3.4.3",
|
||||
"vue-router": "4.2.5",
|
||||
"vuepress-plugin-netlify-functions": "workspace:*"
|
||||
},
|
||||
|
||||
@ -3,14 +3,21 @@
|
||||
使用 [`shikiji`](https://shikiji.netlify.app/) 来为 Markdown 代码块启用代码高亮。
|
||||
|
||||
## Install
|
||||
```
|
||||
|
||||
```sh
|
||||
npm install @vuepress-plume/plugin-shikiji
|
||||
# or
|
||||
pnpm add @vuepress-plume/plugin-shikiji
|
||||
# or
|
||||
yarn add @vuepress-plume/plugin-shikiji
|
||||
```
|
||||
## Usage
|
||||
|
||||
``` js
|
||||
// .vuepress/config.js
|
||||
const shikijiPlugin = require('@vuepress-plume/plugin-shikiji')
|
||||
module.exports = {
|
||||
// .vuepress/config.[jt]s
|
||||
import { shikijiPlugin } from '@vuepress-plume/plugin-shikiji'
|
||||
|
||||
export default {
|
||||
// ...
|
||||
plugins: [
|
||||
shikijiPlugin()
|
||||
|
||||
@ -14,7 +14,10 @@
|
||||
"url": "https://github.com/pengzhanbo/vuepress-theme-plume/issues"
|
||||
},
|
||||
"exports": {
|
||||
".": "./lib/node/index.js",
|
||||
".": {
|
||||
"types": "./lib/node/index.d.ts",
|
||||
"import": "./lib/node/index.js"
|
||||
},
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"main": "lib/node/index.js",
|
||||
@ -33,8 +36,8 @@
|
||||
"@vuepress/utils": "2.0.0-rc.0",
|
||||
"nanoid": "^5.0.4",
|
||||
"picocolors": "^1.0.0",
|
||||
"shikiji": "^0.9.12",
|
||||
"shikiji-transformers": "^0.9.12"
|
||||
"shikiji": "^0.9.15",
|
||||
"shikiji-transformers": "^0.9.15"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
|
||||
@ -30,9 +30,9 @@ export async function highlight(
|
||||
|
||||
const highlighter = await getHighlighter({
|
||||
themes:
|
||||
typeof theme === 'string' || 'name' in theme
|
||||
? [theme]
|
||||
: [theme.light, theme.dark],
|
||||
typeof theme === 'object' && 'light' in theme && 'dark' in theme
|
||||
? [theme.light, theme.dark]
|
||||
: [theme],
|
||||
langs: [...Object.keys(bundledLanguages), ...(options.languages || [])],
|
||||
langAlias: options.languageAlias,
|
||||
})
|
||||
@ -131,12 +131,9 @@ export async function highlight(
|
||||
meta: {
|
||||
__raw: attrs,
|
||||
},
|
||||
...(typeof theme === 'string' || 'name' in theme
|
||||
? { theme }
|
||||
: {
|
||||
themes: theme,
|
||||
defaultColor: false,
|
||||
}),
|
||||
...(typeof theme === 'object' && 'light' in theme && 'dark' in theme
|
||||
? { themes: theme, defaultColor: false }
|
||||
: { theme }),
|
||||
})
|
||||
|
||||
return fillEmptyHighlightedLine(restoreMustache(highlighted))
|
||||
|
||||
1017
pnpm-lock.yaml
generated
1017
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@ -5,11 +5,14 @@
|
||||
[查看使用文档](https://pengzhanbo.cn/note/vuepress-theme-plume)
|
||||
|
||||
## Install
|
||||
|
||||
``` sh
|
||||
# use yarn
|
||||
yarn add vuepress-theme-plume
|
||||
# or npm
|
||||
# npm
|
||||
npm i vuepress-theme-plume
|
||||
# or pnpm
|
||||
pnpm add vuepress-theme-plume
|
||||
# or yarn
|
||||
yarn add vuepress-theme-plume
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
@ -22,10 +22,19 @@
|
||||
"theme-plume"
|
||||
],
|
||||
"exports": {
|
||||
".": "./lib/node/index.js",
|
||||
"./client": "./lib/client/index.js",
|
||||
"./package.json": "./package.json",
|
||||
"./shared": "./lib/shared/index.js"
|
||||
".": {
|
||||
"types": "./lib/node/index.d.ts",
|
||||
"import": "./lib/node/index.js"
|
||||
},
|
||||
"./client": {
|
||||
"types": "./lib/client/index.d.ts",
|
||||
"import": "./lib/client/index.js"
|
||||
},
|
||||
"./shared": {
|
||||
"types": "./lib/shared/index.d.ts",
|
||||
"import": "./lib/shared/index.js"
|
||||
},
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"main": "lib/node/index.js",
|
||||
"types": "lib/node/index.d.ts",
|
||||
@ -73,13 +82,13 @@
|
||||
"lodash.merge": "^4.6.2",
|
||||
"nanoid": "^5.0.4",
|
||||
"ts-debounce": "^4.0.0",
|
||||
"vue": "^3.3.13",
|
||||
"vue": "^3.4.3",
|
||||
"vue-router": "4.2.5",
|
||||
"vuepress-plugin-comment2": "2.0.0-rc.7",
|
||||
"vuepress-plugin-md-enhance": "2.0.0-rc.7",
|
||||
"vuepress-plugin-reading-time2": "2.0.0-rc.7",
|
||||
"vuepress-plugin-seo2": "2.0.0-rc.7",
|
||||
"vuepress-plugin-sitemap2": "2.0.0-rc.7"
|
||||
"vuepress-plugin-comment2": "2.0.0-rc.10",
|
||||
"vuepress-plugin-md-enhance": "2.0.0-rc.10",
|
||||
"vuepress-plugin-reading-time2": "2.0.0-rc.10",
|
||||
"vuepress-plugin-seo2": "2.0.0-rc.10",
|
||||
"vuepress-plugin-sitemap2": "2.0.0-rc.10"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/lodash.merge": "^4.6.9"
|
||||
|
||||
@ -87,15 +87,16 @@
|
||||
}
|
||||
}
|
||||
|
||||
&.note [class*="language-"] code,
|
||||
&.info [class*="language-"] code,
|
||||
&.tip [class*="language-"] code,
|
||||
&.warning [class*="language-"] code,
|
||||
&.caution [class*="language-"] code,
|
||||
&.details [class*="language-"] code {
|
||||
[class*="language-"] code {
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
[class*="language-"] .line-numbers {
|
||||
padding-top: 21px;
|
||||
}
|
||||
|
||||
|
||||
|
||||
th,
|
||||
blockquote > p {
|
||||
font-size: var(--vp-custom-block-font-size);
|
||||
|
||||
@ -6,7 +6,7 @@ import type {
|
||||
PlumeThemeLocaleOptions,
|
||||
PlumeThemePageData,
|
||||
} from '../shared/index.js'
|
||||
import { normalizePath } from './utils.js'
|
||||
import { pathJoin } from './utils.js'
|
||||
|
||||
export async function setupPage(
|
||||
app: App,
|
||||
@ -18,7 +18,7 @@ export async function setupPage(
|
||||
const defaultBlog = localeOption.blog
|
||||
const link = blog?.link
|
||||
? blog.link
|
||||
: normalizePath(path.join('/', locale, defaultBlog?.link || '/blog/'))
|
||||
: pathJoin('/', locale, defaultBlog?.link || '/blog/')
|
||||
const blogPage = await createPage(app, {
|
||||
path: link,
|
||||
frontmatter: {
|
||||
@ -30,7 +30,7 @@ export async function setupPage(
|
||||
|
||||
if (blog?.tags !== false || defaultBlog?.tags !== false) {
|
||||
const tagsPage = await createPage(app, {
|
||||
path: normalizePath(path.join(link, 'tags/')),
|
||||
path: pathJoin(link, 'tags/'),
|
||||
frontmatter: {
|
||||
lang: locale.replace(/^\/|\/$/g, '') || app.siteData.lang,
|
||||
type: 'blog-tags',
|
||||
@ -41,7 +41,7 @@ export async function setupPage(
|
||||
|
||||
if (blog?.archives !== false || defaultBlog?.archives !== false) {
|
||||
const archivesPage = await createPage(app, {
|
||||
path: normalizePath(path.join(link, 'archives/')),
|
||||
path: pathJoin(link, 'archives/'),
|
||||
frontmatter: {
|
||||
lang: locale.replace(/^\/|\/$/g, '') || app.siteData.lang,
|
||||
type: 'blog-archives',
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import type { App, Page, Theme } from '@vuepress/core'
|
||||
import { getDirname, path } from '@vuepress/utils'
|
||||
import { fs, getDirname, path, templateRenderer } from '@vuepress/utils'
|
||||
import type { PlumeThemeOptions, PlumeThemePageData } from '../shared/index.js'
|
||||
import { mergeLocaleOptions } from './defaultOptions.js'
|
||||
import { setupPlugins } from './plugins.js'
|
||||
@ -10,20 +10,38 @@ const name = 'vuepress-theme-plume'
|
||||
const resolve = (...args: string[]) => path.resolve(__dirname, '../', ...args)
|
||||
const templates = (url: string) => resolve('../templates', url)
|
||||
|
||||
function getThemePackage() {
|
||||
let pkg = {} as any
|
||||
try {
|
||||
const content = fs.readFileSync(resolve('../package.json'), 'utf-8')
|
||||
pkg = JSON.parse(content)
|
||||
}
|
||||
catch {}
|
||||
return pkg
|
||||
}
|
||||
|
||||
export function plumeTheme({
|
||||
themePlugins = {},
|
||||
...localeOptions
|
||||
}: PlumeThemeOptions = {}): Theme {
|
||||
localeOptions = mergeLocaleOptions(localeOptions)
|
||||
const pkg = getThemePackage()
|
||||
return (app: App) => {
|
||||
return {
|
||||
name,
|
||||
templateBuild: templates('build.html'),
|
||||
clientConfigFile: resolve('client/config.js'),
|
||||
plugins: setupPlugins(app, themePlugins, localeOptions),
|
||||
onInitialized: async app => await setupPage(app, localeOptions),
|
||||
onInitialized: app => setupPage(app, localeOptions),
|
||||
extendsPage: (page: Page<PlumeThemePageData>) =>
|
||||
extendsPageData(app, page, localeOptions),
|
||||
templateBuildRenderer(template, context) {
|
||||
template = template
|
||||
.replace('{{ themeVersion }}', pkg.version || '')
|
||||
.replace(/^\s+|\s+$/gm, '')
|
||||
.replace(/\n/g, '')
|
||||
return templateRenderer(template, context)
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -4,11 +4,12 @@
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<meta name="generator" content="VuePress {{ version }}">
|
||||
<meta name="theme" content="VuePress Theme Plume {{ themeVersion }}">
|
||||
<script>
|
||||
(function() {
|
||||
const userMode = localStorage.getItem('vuepress-theme-appearance');
|
||||
const systemDarkMode = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches;
|
||||
if (userMode === 'dark' || (userMode !== 'light' && systemDarkMode)) {
|
||||
const um = localStorage.getItem('vuepress-theme-appearance');
|
||||
const sm = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches;
|
||||
if (um === 'dark' || (um !== 'light' && sm)) {
|
||||
document.documentElement.classList.add('dark');
|
||||
}
|
||||
})();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user