mirror of
https://github.com/pengzhanbo/vuepress-theme-plume.git
synced 2026-04-23 10:58:13 +08:00
feat!: update deps and migrate markdown include to official plugin (#372)
This commit is contained in:
parent
e7ba5621f7
commit
23b3db2abd
@ -40,9 +40,9 @@
|
||||
"plume-deps": {
|
||||
"vuepress": "2.0.0-rc.18",
|
||||
"vue": "^3.5.13",
|
||||
"sass-embedded": "^1.80.6",
|
||||
"sass-embedded": "^1.81.0",
|
||||
"sass-loader": "^16.0.3",
|
||||
"http-server": "^14.1.1",
|
||||
"typescript": "^5.6.3"
|
||||
"typescript": "^5.7.2"
|
||||
}
|
||||
}
|
||||
|
||||
@ -19,8 +19,7 @@ export const theme: Theme = plumeTheme({
|
||||
|
||||
markdownEnhance: {
|
||||
demo: true,
|
||||
include: true,
|
||||
chart: true,
|
||||
chartjs: true,
|
||||
echarts: true,
|
||||
mermaid: true,
|
||||
flowchart: true,
|
||||
|
||||
@ -24,18 +24,9 @@ export default defineUserConfig({
|
||||
theme: plumeTheme({
|
||||
plugins: {
|
||||
markdownEnhance: {
|
||||
align: true, // 对齐容器
|
||||
mark: true, // 标记语法
|
||||
tasklist: true, // 任务列表语法
|
||||
attrs: true, // 属性语法
|
||||
sup: true, // 上标语法
|
||||
sub: true, // 下标语法
|
||||
footnote: true, // 注脚语法
|
||||
|
||||
// 以下可选项在 主题中默认不启用,
|
||||
// 请在主题中自行配置
|
||||
// include: true, // Markdown 导入支持
|
||||
// chart: true, // 图表支持
|
||||
// chartjs: true, // 图表支持
|
||||
// echarts: true, // ECharts 图表支持
|
||||
// flowchart: true, // 流程图支持
|
||||
// markmap: true, // Markmap 图表支持
|
||||
@ -70,3 +61,9 @@ export default defineUserConfig({
|
||||
- `katex` / `mathjax` 所实现的功能,您可以使用 `plugins.markdownMath` 进行配置。
|
||||
- `tabs` / `code-tabs` / `hint` / `alerts` 已变更为 主题的内置功能,您无需额外的配置。
|
||||
:::
|
||||
|
||||
::: warning
|
||||
该插件在 `2.0.0-rc.60` 版本中,移除了 `include` 选项。主题从 `1.0.0-rc.120` 版本开始,适配至最新版。
|
||||
由此带来的影响是,使用 `@vuepress/plugin-markdown-include` 插件实现相同的功能,请使用 `plugins.markdownInclude`
|
||||
进行配置。
|
||||
:::
|
||||
|
||||
@ -6,11 +6,21 @@ permalink: /guide/markdown/include/
|
||||
outline: 2
|
||||
---
|
||||
|
||||
::: important 注意
|
||||
|
||||
从 主题的 `v1.0.0-rc.120` 版本开始,导入文件的功能实现,
|
||||
从 [`vuepress-plugin-md-enhance`](https://plugin-md-enhance.vuejs.press)
|
||||
迁移到了 [`@vuepress/plugin-markdown-include`](https://ecosystem.vuejs.press/zh/plugins/markdown/markdown-include.html) 。
|
||||
|
||||
因此在主题配置中,配置项从 `plugins.markdownEnhance.include` 改名为 `plugins.markdownInclude`。
|
||||
如果你有自定义配置,请注意需要进行迁移。
|
||||
:::
|
||||
|
||||
## 概述
|
||||
|
||||
主题支持在 Markdown 文件中导入文件切片。
|
||||
|
||||
导入文件 默认不启用,你可以通过配置来启用它。
|
||||
导入文件 默认启用,你还可以通过配置来自定义行为。
|
||||
|
||||
::: code-tabs
|
||||
@tab .vuepress/config.ts
|
||||
@ -19,8 +29,8 @@ outline: 2
|
||||
export default defineUserConfig({
|
||||
theme: plumeTheme({
|
||||
plugins: {
|
||||
markdownEnhance: {
|
||||
include: true, // [!code highlight]
|
||||
markdownInclude: {
|
||||
// ... options, // [!code highlight]
|
||||
},
|
||||
}
|
||||
})
|
||||
@ -97,14 +107,12 @@ interface IncludeOptions {
|
||||
export default defineUserConfig({
|
||||
theme: plumeTheme({
|
||||
plugins: {
|
||||
markdownEnhance: {
|
||||
include: {
|
||||
resolvePath: (file) => {
|
||||
if (file.startsWith('@src'))
|
||||
return file.replace('@src', path.resolve(__dirname, '..'))
|
||||
markdownInclude: {
|
||||
resolvePath: (file) => {
|
||||
if (file.startsWith('@src'))
|
||||
return file.replace('@src', path.resolve(__dirname, '..'))
|
||||
|
||||
return file
|
||||
},
|
||||
return file
|
||||
},
|
||||
},
|
||||
}
|
||||
@ -127,9 +135,7 @@ export default defineUserConfig({
|
||||
pagePatterns: ['**/*.md', '!**/*.snippet.md', '!.vuepress', '!node_modules'], // [!code ++]
|
||||
theme: plumeTheme({
|
||||
plugins: {
|
||||
markdownEnhance: {
|
||||
include: true,
|
||||
},
|
||||
markdownInclude: true
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
@ -61,7 +61,7 @@ export default defineUserConfig({
|
||||
## 语法
|
||||
|
||||
````md
|
||||
::: chart 标题
|
||||
::: chartjs 标题
|
||||
```json
|
||||
{
|
||||
// 此处为图表配置
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
````md
|
||||
::: chart 块状图案例
|
||||
::: chartjs 块状图案例
|
||||
```json
|
||||
{
|
||||
"type": "bar",
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
````md
|
||||
::: chart 气泡图案例
|
||||
::: chartjs 气泡图案例
|
||||
```json
|
||||
{
|
||||
"type": "bubble",
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
````md
|
||||
::: chart 折线图案例
|
||||
::: chartjs 折线图案例
|
||||
```json
|
||||
{
|
||||
"type": "line",
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
````md
|
||||
::: chart 玫瑰图案例
|
||||
::: chartjs 玫瑰图案例
|
||||
```json
|
||||
{
|
||||
"type": "polarArea",
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
````md
|
||||
::: chart 雷达图案例
|
||||
::: chartjs 雷达图案例
|
||||
```json
|
||||
{
|
||||
"type": "radar",
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
````md
|
||||
::: chart 散点图案例
|
||||
::: chartjs 散点图案例
|
||||
```json
|
||||
{
|
||||
"type": "scatter",
|
||||
|
||||
@ -15,12 +15,12 @@
|
||||
"@iconify/json": "catalog:",
|
||||
"@simonwep/pickr": "^1.9.1",
|
||||
"@vuepress/bundler-vite": "catalog:",
|
||||
"chart.js": "^4.4.6",
|
||||
"chart.js": "^4.4.7",
|
||||
"echarts": "^5.5.1",
|
||||
"flowchart.ts": "^3.0.1",
|
||||
"http-server": "^14.1.1",
|
||||
"mermaid": "^11.4.1",
|
||||
"sass-embedded": "^1.81.0",
|
||||
"sass-embedded": "^1.82.0",
|
||||
"swiper": "^11.1.15",
|
||||
"vue": "catalog:",
|
||||
"vuepress-theme-plume": "workspace:*"
|
||||
|
||||
10
package.json
10
package.json
@ -42,13 +42,13 @@
|
||||
"devDependencies": {
|
||||
"@commitlint/cli": "^19.6.0",
|
||||
"@commitlint/config-conventional": "^19.6.0",
|
||||
"@pengzhanbo/eslint-config-vue": "^1.20.0",
|
||||
"@pengzhanbo/stylelint-config": "^1.20.0",
|
||||
"@pengzhanbo/eslint-config-vue": "^1.21.0",
|
||||
"@pengzhanbo/stylelint-config": "^1.21.0",
|
||||
"@types/lodash.merge": "^4.6.9",
|
||||
"@types/minimist": "^1.2.5",
|
||||
"@types/node": "20.12.10",
|
||||
"@types/webpack-env": "^1.18.5",
|
||||
"@vitest/coverage-istanbul": "^2.1.6",
|
||||
"@vitest/coverage-istanbul": "^2.1.8",
|
||||
"bumpp": "^9.8.1",
|
||||
"commitizen": "^4.3.1",
|
||||
"conventional-changelog-cli": "^5.0.0",
|
||||
@ -59,14 +59,14 @@
|
||||
"husky": "^9.1.7",
|
||||
"lint-staged": "^15.2.10",
|
||||
"markdown-it": "^14.1.0",
|
||||
"memfs": "^4.14.0",
|
||||
"memfs": "^4.14.1",
|
||||
"minimist": "^1.2.8",
|
||||
"rimraf": "^6.0.1",
|
||||
"stylelint": "^16.11.0",
|
||||
"tsconfig-vuepress": "^5.2.1",
|
||||
"tsup": "^8.3.5",
|
||||
"typescript": "^5.7.2",
|
||||
"vitest": "^2.1.6",
|
||||
"vitest": "^2.1.8",
|
||||
"wait-on": "^8.0.1"
|
||||
},
|
||||
"resolutions": {
|
||||
|
||||
@ -47,7 +47,7 @@
|
||||
"focus-trap": "^7.6.2",
|
||||
"mark.js": "^8.11.1",
|
||||
"minisearch": "^7.1.1",
|
||||
"p-map": "^7.0.2",
|
||||
"p-map": "^7.0.3",
|
||||
"vue": "catalog:"
|
||||
},
|
||||
"publishConfig": {
|
||||
|
||||
1668
pnpm-lock.yaml
generated
1668
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@ -3,31 +3,31 @@ packages:
|
||||
- theme
|
||||
- cli
|
||||
- plugins/*
|
||||
|
||||
catalog:
|
||||
vue: ^3.5.13
|
||||
vuepress: 2.0.0-rc.18
|
||||
'@iconify/json': ^2.2.279
|
||||
'@vuepress/bundler-vite': 2.0.0-rc.18
|
||||
'@vuepress/helper': 2.0.0-rc.60
|
||||
'@vuepress/plugin-cache': 2.0.0-rc.54
|
||||
'@vuepress/plugin-comment': 2.0.0-rc.60
|
||||
'@vuepress/plugin-docsearch': 2.0.0-rc.60
|
||||
'@vuepress/plugin-git': 2.0.0-rc.60
|
||||
'@vuepress/plugin-markdown-hint': 2.0.0-rc.60
|
||||
'@vuepress/plugin-markdown-image': 2.0.0-rc.60
|
||||
'@vuepress/plugin-markdown-math': 2.0.0-rc.60
|
||||
'@vuepress/plugin-nprogress': 2.0.0-rc.60
|
||||
'@vuepress/plugin-photo-swipe': 2.0.0-rc.60
|
||||
'@vuepress/plugin-reading-time': 2.0.0-rc.60
|
||||
'@vuepress/plugin-seo': 2.0.0-rc.60
|
||||
'@vuepress/plugin-sitemap': 2.0.0-rc.60
|
||||
'@vuepress/plugin-watermark': 2.0.0-rc.60
|
||||
'@vuepress/helper': 2.0.0-rc.63
|
||||
'@vuepress/plugin-cache': 2.0.0-rc.61
|
||||
'@vuepress/plugin-comment': 2.0.0-rc.63
|
||||
'@vuepress/plugin-docsearch': 2.0.0-rc.63
|
||||
'@vuepress/plugin-markdown-include': 2.0.0-rc.63
|
||||
'@vuepress/plugin-git': 2.0.0-rc.62
|
||||
'@vuepress/plugin-markdown-hint': 2.0.0-rc.63
|
||||
'@vuepress/plugin-markdown-image': 2.0.0-rc.63
|
||||
'@vuepress/plugin-markdown-math': 2.0.0-rc.63
|
||||
'@vuepress/plugin-nprogress': 2.0.0-rc.63
|
||||
'@vuepress/plugin-photo-swipe': 2.0.0-rc.63
|
||||
'@vuepress/plugin-reading-time': 2.0.0-rc.63
|
||||
'@vuepress/plugin-seo': 2.0.0-rc.63
|
||||
'@vuepress/plugin-sitemap': 2.0.0-rc.63
|
||||
'@vuepress/plugin-watermark': 2.0.0-rc.63
|
||||
'@vueuse/core': ^12.0.0
|
||||
'@vueuse/integrations': ^12.0.0
|
||||
'@iconify/json': ^2.2.277
|
||||
chokidar: 3.6.0
|
||||
fast-glob: ^3.3.2
|
||||
gray-matter: ^4.0.3
|
||||
json2yaml: ^1.1.0
|
||||
fast-glob: ^3.3.2
|
||||
local-pkg: ^0.5.1
|
||||
nanoid: ^5.0.9
|
||||
vue: ^3.5.13
|
||||
vuepress: 2.0.0-rc.18
|
||||
|
||||
@ -64,9 +64,9 @@
|
||||
"peerDependencies": {
|
||||
"@iconify/json": "^2",
|
||||
"mathjax-full": "^3.2.2",
|
||||
"sass": "^1.80.0",
|
||||
"sass-embedded": "^1.80.0",
|
||||
"sass-loader": "^16.0.2",
|
||||
"sass": "^1.81.0",
|
||||
"sass-embedded": "^1.81.0",
|
||||
"sass-loader": "^16.0.3",
|
||||
"swiper": "^11.0.0",
|
||||
"vuepress": "catalog:"
|
||||
},
|
||||
@ -105,6 +105,7 @@
|
||||
"@vuepress/plugin-git": "catalog:",
|
||||
"@vuepress/plugin-markdown-hint": "catalog:",
|
||||
"@vuepress/plugin-markdown-image": "catalog:",
|
||||
"@vuepress/plugin-markdown-include": "catalog:",
|
||||
"@vuepress/plugin-markdown-math": "catalog:",
|
||||
"@vuepress/plugin-nprogress": "catalog:",
|
||||
"@vuepress/plugin-photo-swipe": "catalog:",
|
||||
@ -125,7 +126,7 @@
|
||||
"local-pkg": "catalog:",
|
||||
"nanoid": "catalog:",
|
||||
"vue": "catalog:",
|
||||
"vuepress-plugin-md-enhance": "2.0.0-rc.59",
|
||||
"vuepress-plugin-md-enhance": "2.0.0-rc.60",
|
||||
"vuepress-plugin-md-power": "workspace:*"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@ -11,6 +11,7 @@ import { docsearchPlugin } from '@vuepress/plugin-docsearch'
|
||||
import { gitPlugin } from '@vuepress/plugin-git'
|
||||
import { markdownHintPlugin } from '@vuepress/plugin-markdown-hint'
|
||||
import { markdownImagePlugin } from '@vuepress/plugin-markdown-image'
|
||||
import { markdownIncludePlugin } from '@vuepress/plugin-markdown-include'
|
||||
import { markdownMathPlugin } from '@vuepress/plugin-markdown-math'
|
||||
import { nprogressPlugin } from '@vuepress/plugin-nprogress'
|
||||
import { photoSwipePlugin } from '@vuepress/plugin-photo-swipe'
|
||||
@ -18,10 +19,9 @@ import { readingTimePlugin } from '@vuepress/plugin-reading-time'
|
||||
import { seoPlugin, type SeoPluginOptions } from '@vuepress/plugin-seo'
|
||||
import { sitemapPlugin, type SitemapPluginOptions } from '@vuepress/plugin-sitemap'
|
||||
import { watermarkPlugin } from '@vuepress/plugin-watermark'
|
||||
import { type MarkdownEnhancePluginOptions, mdEnhancePlugin } from 'vuepress-plugin-md-enhance'
|
||||
import { mdEnhancePlugin } from 'vuepress-plugin-md-enhance'
|
||||
import { markdownPowerPlugin } from 'vuepress-plugin-md-power'
|
||||
import { resolveDocsearchOptions, resolveSearchOptions } from '../config/index.js'
|
||||
import { omit } from '../utils/index.js'
|
||||
|
||||
export interface SetupPluginOptions {
|
||||
app: App
|
||||
@ -115,12 +115,8 @@ export function getPlugins(
|
||||
}))
|
||||
}
|
||||
|
||||
if (pluginOptions.markdownEnhance !== false) {
|
||||
const options: MarkdownEnhancePluginOptions = {
|
||||
...pluginOptions.markdownEnhance,
|
||||
}
|
||||
plugins.push(mdEnhancePlugin(omit(options, 'hint', 'alert', 'imgSize', 'imgLazyload', 'imgMark', 'figure', 'obsidianImgSize', 'katex', 'mathjax', 'tabs', 'codetabs', 'align', 'mark', 'sub', 'sup', 'attrs', 'tasklist', 'footnote')))
|
||||
}
|
||||
if (pluginOptions.markdownEnhance !== false)
|
||||
plugins.push(mdEnhancePlugin(pluginOptions.markdownEnhance))
|
||||
|
||||
if (pluginOptions.markdownPower !== false) {
|
||||
plugins.push(markdownPowerPlugin({
|
||||
@ -142,6 +138,10 @@ export function getPlugins(
|
||||
plugins.push(markdownImagePlugin(pluginOptions.markdownImage))
|
||||
}
|
||||
|
||||
if (pluginOptions.markdownInclude !== false) {
|
||||
plugins.push(markdownIncludePlugin(isPlainObject(pluginOptions.markdownInclude) ? pluginOptions.markdownInclude : {}))
|
||||
}
|
||||
|
||||
if (pluginOptions.watermark) {
|
||||
plugins.push(watermarkPlugin({
|
||||
delay: 300,
|
||||
|
||||
@ -3,6 +3,7 @@ import type { ShikiPluginOptions } from '@vuepress-plume/plugin-shikiji'
|
||||
import type { CommentPluginOptions } from '@vuepress/plugin-comment'
|
||||
import type { DocSearchOptions } from '@vuepress/plugin-docsearch'
|
||||
import type { MarkdownImagePluginOptions } from '@vuepress/plugin-markdown-image'
|
||||
import type { MarkdownIncludePluginOptions } from '@vuepress/plugin-markdown-include'
|
||||
import type { MarkdownMathPluginOptions } from '@vuepress/plugin-markdown-math'
|
||||
import type { ReadingTimePluginOptions } from '@vuepress/plugin-reading-time'
|
||||
import type { SeoPluginOptions } from '@vuepress/plugin-seo'
|
||||
@ -43,13 +44,7 @@ export interface PlumeThemePluginOptions {
|
||||
* - `imgSize`, `imgMark`, `imgLazyload`, `figure`, `obsidianImgSize` 已迁移至 `@vuepress/plugin-markdown-image`, 请使用 `plugins.markdownImage` 配置项代替。
|
||||
* - `katex`, `mathjax` 已迁移至 `@vuepress/plugin-markdown-math`, 请使用 `plugins.markdownMath` 配置项代替
|
||||
*/
|
||||
markdownEnhance?:
|
||||
| false
|
||||
| Omit<
|
||||
MarkdownEnhancePluginOptions,
|
||||
'hint' | 'alert' | 'imgSize' | 'imgMark' | 'imgLazyload' | 'figure' | 'obsidianImgSize'
|
||||
| 'katex' | 'mathjax'
|
||||
>
|
||||
markdownEnhance?: false | MarkdownEnhancePluginOptions
|
||||
|
||||
markdownPower?: false | MarkdownPowerPluginOptions
|
||||
|
||||
@ -69,6 +64,15 @@ export interface PlumeThemePluginOptions {
|
||||
*/
|
||||
markdownMath?: false | MarkdownMathPluginOptions
|
||||
|
||||
/**
|
||||
* 是否启用 `@vuepress/plugin-markdown-include` 插件
|
||||
*
|
||||
* @default true
|
||||
*
|
||||
* @see https://ecosystem.vuejs.press/zh/plugins/markdown/markdown-include.html
|
||||
*/
|
||||
markdownInclude?: boolean | MarkdownIncludePluginOptions
|
||||
|
||||
comment?: false | CommentPluginOptions
|
||||
|
||||
sitemap?: false | Omit<SitemapPluginOptions, 'hostname'> & { hostname?: string }
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user