perf: 调整包导入格式,优化文档说明
This commit is contained in:
parent
a69a8ead5d
commit
fb2703fb56
@ -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,7 +39,6 @@
|
||||
"@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",
|
||||
|
||||
@ -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,7 +38,6 @@
|
||||
"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.4.3",
|
||||
"vue-router": "4.2.5"
|
||||
|
||||
@ -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",
|
||||
|
||||
@ -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",
|
||||
|
||||
@ -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",
|
||||
|
||||
@ -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",
|
||||
|
||||
@ -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",
|
||||
|
||||
@ -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))
|
||||
|
||||
@ -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",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user