Skip to content

Commit

Permalink
feat!: update deps and migrate markdown include to official plugin (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
pengzhanbo authored Dec 6, 2024
1 parent e7ba562 commit 23b3db2
Show file tree
Hide file tree
Showing 19 changed files with 628 additions and 1,181 deletions.
4 changes: 2 additions & 2 deletions cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
3 changes: 1 addition & 2 deletions docs/.vuepress/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ export const theme: Theme = plumeTheme({

markdownEnhance: {
demo: true,
include: true,
chart: true,
chartjs: true,
echarts: true,
mermaid: true,
flowchart: true,
Expand Down
17 changes: 7 additions & 10 deletions docs/notes/theme/config/plugins/markdown增强.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 图表支持
Expand Down Expand Up @@ -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`
进行配置。
:::
34 changes: 20 additions & 14 deletions docs/notes/theme/guide/markdown/导入文件.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -19,8 +29,8 @@ outline: 2
export default defineUserConfig({
theme: plumeTheme({
plugins: {
markdownEnhance: {
include: true, // [!code highlight]
markdownInclude: {
// ... options, // [!code highlight]
},
}
})
Expand Down Expand Up @@ -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, '..'))
return file
},
markdownInclude: {
resolvePath: (file) => {
if (file.startsWith('@src'))
return file.replace('@src', path.resolve(__dirname, '..'))
return file
},
},
}
Expand All @@ -127,9 +135,7 @@ export default defineUserConfig({
pagePatterns: ['**/*.md', '!**/*.snippet.md', '!.vuepress', '!node_modules'], // [!code ++]
theme: plumeTheme({
plugins: {
markdownEnhance: {
include: true,
},
markdownInclude: true
}
})
})
Expand Down
2 changes: 1 addition & 1 deletion docs/notes/theme/guide/图表/chart.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export default defineUserConfig({
## 语法

````md
::: chart 标题
::: chartjs 标题
```json
{
// 此处为图表配置
Expand Down
2 changes: 1 addition & 1 deletion docs/notes/theme/snippet/chart-1.snippet.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
````md
::: chart 块状图案例
::: chartjs 块状图案例
```json
{
"type": "bar",
Expand Down
2 changes: 1 addition & 1 deletion docs/notes/theme/snippet/chart-2.snippet.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
````md
::: chart 气泡图案例
::: chartjs 气泡图案例
```json
{
"type": "bubble",
Expand Down
2 changes: 1 addition & 1 deletion docs/notes/theme/snippet/chart-3.snippet.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
````md
::: chart 折线图案例
::: chartjs 折线图案例
```json
{
"type": "line",
Expand Down
2 changes: 1 addition & 1 deletion docs/notes/theme/snippet/chart-4.snippet.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
````md
::: chart 玫瑰图案例
::: chartjs 玫瑰图案例
```json
{
"type": "polarArea",
Expand Down
2 changes: 1 addition & 1 deletion docs/notes/theme/snippet/chart-5.snippet.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
````md
::: chart 雷达图案例
::: chartjs 雷达图案例
```json
{
"type": "radar",
Expand Down
2 changes: 1 addition & 1 deletion docs/notes/theme/snippet/chart-6.snippet.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
````md
::: chart 散点图案例
::: chartjs 散点图案例
```json
{
"type": "scatter",
Expand Down
4 changes: 2 additions & 2 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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:*"
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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": {
Expand Down
2 changes: 1 addition & 1 deletion plugins/plugin-search/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
Loading

0 comments on commit 23b3db2

Please sign in to comment.