From 6c24c50f1306a06000fab28575814715aa1b50e1 Mon Sep 17 00:00:00 2001 From: Mister-Hope Date: Fri, 25 Oct 2024 02:11:50 +0800 Subject: [PATCH] feat: add plugin-markdown-stylize (#279) --- .vscode/settings.json | 1 + docs/.vuepress/config.ts | 24 ++ docs/.vuepress/configs/sidebar/en.ts | 1 + docs/.vuepress/configs/sidebar/zh.ts | 1 + docs/package.json | 1 + docs/plugins/markdown/markdown-stylize.md | 257 ++++++++++++++++++ docs/zh/plugins/markdown/markdown-stylize.md | 257 ++++++++++++++++++ .../plugin-markdown-stylize/package.json | 62 +++++ .../plugin-markdown-stylize/rollup.config.ts | 13 + .../plugin-markdown-stylize/src/node/index.ts | 2 + .../src/node/markdownStylizePlugin.ts | 43 +++ .../src/node/options.ts | 65 +++++ .../src/node/prepareConfigFile.ts | 15 + .../tsconfig.build.json | 9 + pnpm-lock.yaml | 164 +++++++++-- tsconfig.build.json | 3 + 16 files changed, 900 insertions(+), 18 deletions(-) create mode 100644 docs/plugins/markdown/markdown-stylize.md create mode 100644 docs/zh/plugins/markdown/markdown-stylize.md create mode 100644 plugins/markdown/plugin-markdown-stylize/package.json create mode 100644 plugins/markdown/plugin-markdown-stylize/rollup.config.ts create mode 100644 plugins/markdown/plugin-markdown-stylize/src/node/index.ts create mode 100644 plugins/markdown/plugin-markdown-stylize/src/node/markdownStylizePlugin.ts create mode 100644 plugins/markdown/plugin-markdown-stylize/src/node/options.ts create mode 100644 plugins/markdown/plugin-markdown-stylize/src/node/prepareConfigFile.ts create mode 100644 plugins/markdown/plugin-markdown-stylize/tsconfig.build.json diff --git a/.vscode/settings.json b/.vscode/settings.json index 0914fe961c..8d4a5479ce 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -46,6 +46,7 @@ "prefetch", "preload", "prismjs", + "revealjs", "shiki", "shikijs", "slugify", diff --git a/docs/.vuepress/config.ts b/docs/.vuepress/config.ts index ec603a0792..3f7bff54bb 100644 --- a/docs/.vuepress/config.ts +++ b/docs/.vuepress/config.ts @@ -10,6 +10,7 @@ import { feedPlugin } from '@vuepress/plugin-feed' import { markdownExtPlugin } from '@vuepress/plugin-markdown-ext' import { markdownImagePlugin } from '@vuepress/plugin-markdown-image' import { markdownMathPlugin } from '@vuepress/plugin-markdown-math' +import { markdownStylizePlugin } from '@vuepress/plugin-markdown-stylize' import { redirectPlugin } from '@vuepress/plugin-redirect' import { registerComponentsPlugin } from '@vuepress/plugin-register-components' import { revealJsPlugin } from '@vuepress/plugin-revealjs' @@ -100,6 +101,29 @@ export default defineUserConfig({ markdownMathPlugin({ type: 'katex', }), + markdownStylizePlugin({ + align: true, + attrs: true, + mark: true, + spoiler: true, + sub: true, + sup: true, + custom: [ + { + matcher: 'Recommended', + replacer: ({ tag }) => { + if (tag === 'em') + return { + tag: 'Badge', + attrs: { type: 'tip' }, + content: 'Recommended', + } + + return null + }, + }, + ], + }), redirectPlugin({ switchLocale: 'modal', }), diff --git a/docs/.vuepress/configs/sidebar/en.ts b/docs/.vuepress/configs/sidebar/en.ts index 14cecbd128..15fbb80dcf 100644 --- a/docs/.vuepress/configs/sidebar/en.ts +++ b/docs/.vuepress/configs/sidebar/en.ts @@ -103,6 +103,7 @@ export const sidebarEn: SidebarOptions = { 'markdown-image', 'markdown-hint', 'markdown-math', + 'markdown-stylize', 'markdown-tab', 'links-check', 'prismjs', diff --git a/docs/.vuepress/configs/sidebar/zh.ts b/docs/.vuepress/configs/sidebar/zh.ts index 41c807fc1a..e2542f78c9 100644 --- a/docs/.vuepress/configs/sidebar/zh.ts +++ b/docs/.vuepress/configs/sidebar/zh.ts @@ -103,6 +103,7 @@ export const sidebarZh: SidebarOptions = { 'markdown-image', 'markdown-hint', 'markdown-math', + 'markdown-stylize', 'markdown-tab', 'links-check', 'prismjs', diff --git a/docs/package.json b/docs/package.json index 5d3e203adf..880001e3fb 100644 --- a/docs/package.json +++ b/docs/package.json @@ -21,6 +21,7 @@ "@vuepress/plugin-markdown-ext": "workspace:*", "@vuepress/plugin-markdown-image": "workspace:*", "@vuepress/plugin-markdown-math": "workspace:*", + "@vuepress/plugin-markdown-stylize": "workspace:*", "@vuepress/plugin-markdown-tab": "workspace:*", "@vuepress/plugin-medium-zoom": "workspace:*", "@vuepress/plugin-nprogress": "workspace:*", diff --git a/docs/plugins/markdown/markdown-stylize.md b/docs/plugins/markdown/markdown-stylize.md new file mode 100644 index 0000000000..447f4b3992 --- /dev/null +++ b/docs/plugins/markdown/markdown-stylize.md @@ -0,0 +1,257 @@ +# markdown-stylize + + + +Stylizing content in your VuePress site. + +## Usage + +```bash +npm i -D @vuepress/plugin-markdown-stylize@next +``` + +```ts +import { markdownStylizePlugin } from '@vuepress/plugin-markdown-stylize' + +export default { + plugins: [ + markdownStylizePlugin({ + // options + }), + ], +} +``` + +## Syntax + +### Align Content + +You can use `left` `center` `right` `justify` to align text. + +:::: details Demo + +::: left +Contents to align left +::: + +::: center +Contents to align center +::: + +::: right +Contents to align right +::: + +::: justify +Contents to align justify +::: + +```md +::: left +Contents to align left +::: + +::: center +Contents to align center +::: + +::: right +Contents to align right +::: + +::: justify +Contents to align justify +::: +``` + +:::: + +### Appending Attributes + +You can use `{attrs}` to add attrs to Markdown content. + +For example, if you want a heading2 "Hello World" with an id "say-hello-world", you can write: + +```md +## Hello World {#say-hello-world} +``` + +If you want an image with class "full-width", you can write: + +```md +![img](link/to/image.png) {.full-width} +``` + +Also, other attrs are supported, so: + +```md +A paragraph with some text. {#p .a .b align=center customize-attr="content with spaces"} +``` + +will be rendered into: + +```html +

+ A paragraph with some text. +

+``` + +For all demos, see [@mdit/plugin-attrs](https://mdit-plugins.github.io/attrs.html#demo). + +### Highlighting Content + +You can use `==` to mark text with ``. + +::: details Demo + +VuePress is ==powerful==! + +```md +VuePress is ==powerful==! +``` + +::: + +### Creating Spoilers + +You can use `!! !!` to mark a content as spoiler. + +::: details Demo + +VuePress is !!powerful!!. + +```md +VuePress is !!powerful!!. +``` + +::: + +### Superscript and Subscript + +You can use `^` for superscript and `~` for subscript. + +::: details Demo + +H~2~O is a liquid. 2^10^ is 1024. + +```md +H~2~O is a liquid. 2^10^ is 1024. +``` + +::: + +### Create your own stylize rules + +The `custom` option receives an array, where each element accepts 2 options: + +- `matcher`: should be `string` or `RegExp`. + +- `replacer`: a function customizing the matched token + +For example, you can use the following config to transform `*Recommended*` into a Badge Recommended + +```js {6-18} title=".vuepress/config.js" +import { markdownStylizePlugin } from '@vuepress/plugin-markdown-stylize' + +export default { + plugins: [ + markdownStylizePlugin({ + custom: [ + { + matcher: 'Recommended', + replacer: ({ tag }) => { + if (tag === 'em') + return { + tag: 'Badge', + attrs: { type: 'tip' }, + content: 'Recommended', + } + + return null + }, + }, + ], + }), + ], +} +``` + +Another example is you want to set all the emphasis `n't` words to red color, so that `Setting this to an invalid syntax *doesn't* have any effect.` becomes: "Setting this to an invalid syntax doesn't have any effect." + +```js {6-18} title=".vuepress/config.js" +import { markdownStylizePlugin } from '@vuepress/plugin-markdown-stylize' + +export default { + plugins: [ + markdownStylizePlugin({ + custom: [ + { + matcher: /n't$/, + replacer: ({ tag, attrs, content }) => { + if (tag === 'em') + return { + tag: 'span', + attrs: { ...attrs, style: 'color: red' }, + content, + } + + return null + }, + }, + ], + }), + ], +} +``` + +Also, you can use `stylize` in frontmatter to provide extra stylize rules for content of the page. + +## Options + +### align + +- Type: `boolean` + +- Details: Whether to enable align support + +### attrs + +- Type: `MarkdownItAttrsOptions | boolean` + +- Details: + + Whether to enable attrs support. + + You can also pass an object to specify the options of [@mdit/plugin-attrs](https://mdit-plugins.github.io/attrs.html#advanced). + +### mark + +- Type: `boolean` + +- Details: Whether to enable mark format support + +### spoiler + +- Type: `boolean` + +- Details: Whether to enable spoiler support + +### sup + +- Type: `boolean` + +- Details: Whether to enable superscript format support + +### sub + +- Type: `boolean` + +- Details: Whether to enable subscript format support + +### custom + +- Type: `MarkdownItStylizeConfig[]` + +- Details: + + Create own stylize customizations. For details, see [@mdit/plugin-stylize](https://mdit-plugins.github.io/stylize.html#usage) diff --git a/docs/zh/plugins/markdown/markdown-stylize.md b/docs/zh/plugins/markdown/markdown-stylize.md new file mode 100644 index 0000000000..c2ae4254c8 --- /dev/null +++ b/docs/zh/plugins/markdown/markdown-stylize.md @@ -0,0 +1,257 @@ +# markdown-stylize + + + +在 VuePress 站点中为内容添加样式。 + +## 使用方法 + +```bash +npm i -D @vuepress/plugin-markdown-stylize@next +``` + +```ts +import { markdownStylizePlugin } from '@vuepress/plugin-markdown-stylize' + +export default { + plugins: [ + markdownStylizePlugin({ + // 配置项 + }), + ], +} +``` + +## 语法 + +### 对齐内容 + +你可以使用 `left` `center` `right` `justify` 来对齐文本。 + +:::: details 示例 + +::: left +左对齐的内容 +::: + +::: center +居中的内容 +::: + +::: right +右对齐的内容 +::: + +::: justify +两端对齐的内容 +::: + +```md +::: left +左对齐的内容 +::: + +::: center +居中的内容 +::: + +::: right +右对齐的内容 +::: + +::: justify +两端对齐的内容 +::: +``` + +:::: + +### 添加属性 + +你可以使用语法 `{attrs}` 来为 Markdown 元素添加属性。 + +比如,如果你想要一个 id 为 say-hello-world,文字为 Hello World 的二级标题,你可以使用: + +```md +## Hello World {#say-hello-world} +``` + +如果你想要一个有 full-width Class 的图片,你可以使用: + +```md +![img](link/to/image.png) {.full-width} +``` + +同时也支持其他属性: + +```md +一个包含文字的段落。 {#p .a .b align=center customize-attr="content with spaces"} +``` + +会被渲染为: + +```html +

+ 一个包含文字的段落。 +

+``` + +完整的示例请参考 [@mdit/plugin-attrs](https://mdit-plugins.github.io/zh/attrs.html#demo)。 + +### 高亮内容 + +你可以使用 `== ==` 来通过 `` 标记内容。请注意标记两侧需要有空格。 + +::: details 案例 + +VuePress ==非常== 强大! + +```md +VuePress ==非常== 强大! +``` + +::: + +### 创建剧透 + +你可以使用使用 `!! !!` 标记剧透文字。请注意标记两侧需要有空格。 + +::: details 案例 + +VuePress !!非常强大!!! + +```md +VuePress !!非常强大!!! +``` + +::: + +### 上下标 + +你可以使用 `^` 来标记上标,`~` 来标记下标。 + +::: details 案例 + +H~2~O 是液体,2^10^ 是 1024. + +```md +H~2~O 是液体,2^10^ 是 1024. +``` + +::: + +### 创建自己的样式化 + +`custom` 选项接收一个数组,其中每个元素接受 2 个选项: + +- `matcher`:应为 `string` 或 `RegExp`。 + +- `replacer`: 自定义匹配标记的函数 + +例如,你可以使用以下配置将 `*推荐*` 转换为徽章 推荐: + +```js {6-18} title=".vuepress/config.js" +import { mdEnhancePlugin } from 'vuepress-plugin-md-enhance' + +export default { + plugins: [ + mdEnhancePlugin({ + stylize: [ + { + matcher: '推荐', + replacer: ({ tag }) => { + if (tag === 'em') + return { + tag: 'Badge', + attrs: { type: 'tip' }, + content: '推荐', + } + + return null + }, + }, + ], + }), + ], +} +``` + +另一个例子是你想要将所有的“不或者没”开头的强调词设置为红色,这样 `设置它*没有*任何效果,请*不要*这样使用。`变成:“设置它没有任何效果,请不要这样使用。" + +```js {6-18} title=".vuepress/config.js" +import { mdEnhancePlugin } from 'vuepress-plugin-md-enhance' + +export default { + plugins: [ + mdEnhancePlugin({ + stylize: [ + { + matcher: /^(不|没)/, + replacer: ({ tag, attrs, content }) => { + if (tag === 'em') + return { + tag: 'span', + attrs: { ...attrs, style: 'color: red' }, + content, + } + + return null + }, + }, + ], + }), + ], +} +``` + +同时,你也可以在 frontmatter 总通过 `stylize` 选项来自定义此页面额外的匹配标记的函数。 + +## 配置项 + +### align + +- 类型: `boolean` + +- 详情: 是否启用对齐支持。 + +### attrs + +- 类型: `MarkdownItAttrsOptions | boolean` + +- 详情: + + 是否启用 attrs 支持。 + + 你也可以传递一个对象来指定 [@mdit/plugin-attrs](https://mdit-plugins.github.io/zh/attrs.html#高级) 的选项。 + +### mark + +- 类型: `boolean` + +- 详情: 是否启用标记格式支持。 + +### spoiler + +- 类型: `boolean` + +- 详情: 是否启用剧透支持。 + +### sup + +- 类型: `boolean` + +- 详情: 是否启用上标格式支持。 + +### sub + +- 类型: `boolean` + +- 详情: 是否启用下标格式支持。 + +### custom + +- 类型: `MarkdownStylizeCustomOptions[]` + +- 详情: + + 创建自定义样式化。详情请参阅 [@mdit/plugin-stylize](https://mdit-plugins.github.io/zh/stylize.html#使用) diff --git a/plugins/markdown/plugin-markdown-stylize/package.json b/plugins/markdown/plugin-markdown-stylize/package.json new file mode 100644 index 0000000000..6de8356d5d --- /dev/null +++ b/plugins/markdown/plugin-markdown-stylize/package.json @@ -0,0 +1,62 @@ +{ + "name": "@vuepress/plugin-markdown-stylize", + "version": "2.0.0-rc.54", + "description": "VuePress plugin - markdown stylize", + "keywords": [ + "vuepress-plugin", + "vuepress", + "plugin", + "markdown", + "stylize" + ], + "homepage": "https://ecosystem.vuejs.press/plugins/markdown/markdown-stylize.html", + "bugs": { + "url": "https://github.com/vuepress/ecosystem/issues" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/vuepress/ecosystem.git", + "directory": "plugins/markdown/plugin-markdown-stylize" + }, + "license": "MIT", + "author": { + "name": "Mr.Hope", + "email": "mister-hope@outlook.com", + "url": "https://mister-hope.com" + }, + "type": "module", + "exports": { + ".": "./lib/node/index.js", + "./package.json": "./package.json" + }, + "main": "./lib/node/index.js", + "types": "./lib/node/index.d.ts", + "files": [ + "lib" + ], + "scripts": { + "build": "tsc -b tsconfig.build.json", + "bundle": "rollup -c rollup.config.ts --configPlugin esbuild", + "clean": "rimraf --glob ./lib ./*.tsbuildinfo" + }, + "dependencies": { + "@mdit/plugin-align": "^0.13.1", + "@mdit/plugin-attrs": "^0.13.1", + "@mdit/plugin-mark": "^0.13.1", + "@mdit/plugin-spoiler": "^0.13.1", + "@mdit/plugin-stylize": "^0.13.3", + "@mdit/plugin-sub": "^0.13.1", + "@mdit/plugin-sup": "^0.13.1", + "@types/markdown-it": "^14.1.2", + "@vuepress/helper": "workspace:*" + }, + "peerDependencies": { + "vuepress": "2.0.0-rc.18" + }, + "devDependencies": { + "markdown-it": "^14.1.0" + }, + "publishConfig": { + "access": "public" + } +} diff --git a/plugins/markdown/plugin-markdown-stylize/rollup.config.ts b/plugins/markdown/plugin-markdown-stylize/rollup.config.ts new file mode 100644 index 0000000000..f970a5d278 --- /dev/null +++ b/plugins/markdown/plugin-markdown-stylize/rollup.config.ts @@ -0,0 +1,13 @@ +import { rollupBundle } from '../../../scripts/rollup.js' + +export default rollupBundle('node/index', { + external: [ + '@mdit/plugin-align', + '@mdit/plugin-attrs', + '@mdit/plugin-mark', + '@mdit/plugin-spoiler', + '@mdit/plugin-stylize', + '@mdit/plugin-sub', + '@mdit/plugin-sup', + ], +}) diff --git a/plugins/markdown/plugin-markdown-stylize/src/node/index.ts b/plugins/markdown/plugin-markdown-stylize/src/node/index.ts new file mode 100644 index 0000000000..3bb01fbdf6 --- /dev/null +++ b/plugins/markdown/plugin-markdown-stylize/src/node/index.ts @@ -0,0 +1,2 @@ +export * from './markdownStylizePlugin.js' +export type * from './options.js' diff --git a/plugins/markdown/plugin-markdown-stylize/src/node/markdownStylizePlugin.ts b/plugins/markdown/plugin-markdown-stylize/src/node/markdownStylizePlugin.ts new file mode 100644 index 0000000000..cff6d25b67 --- /dev/null +++ b/plugins/markdown/plugin-markdown-stylize/src/node/markdownStylizePlugin.ts @@ -0,0 +1,43 @@ +import { align as alignPlugin } from '@mdit/plugin-align' +import { attrs as attrsPlugin } from '@mdit/plugin-attrs' +import { mark as markPlugin } from '@mdit/plugin-mark' +import { spoiler as spoilerPlugin } from '@mdit/plugin-spoiler' +import { stylize as stylizePlugin } from '@mdit/plugin-stylize' +import { sub as subPlugin } from '@mdit/plugin-sub' +import { sup as supPlugin } from '@mdit/plugin-sup' +import type { Plugin } from 'vuepress/core' +import type { MarkdownEnv } from 'vuepress/markdown' +import { isPlainObject } from 'vuepress/shared' +import type { MarkdownStylizePluginOptions } from './options.js' +import { prepareConfigFile } from './prepareConfigFile.js' + +export const markdownStylizePlugin = ({ + attrs, + align, + custom, + mark, + spoiler, + sup, + sub, +}: MarkdownStylizePluginOptions): Plugin => { + return { + name: '@vuepress/plugin-markdown-stylize', + + extendsMarkdown: (md) => { + if (custom) + md.use(stylizePlugin, { + config: custom, + localConfigGetter: (env: MarkdownEnv) => + env.frontmatter?.stylize || null, + }) + if (attrs) md.use(attrsPlugin, isPlainObject(attrs) ? attrs : {}) + if (align) md.use(alignPlugin) + if (mark) md.use(markPlugin) + if (spoiler) md.use(spoilerPlugin) + if (sub) md.use(subPlugin) + if (sup) md.use(supPlugin) + }, + + clientConfigFile: (app) => prepareConfigFile(app, { spoiler }), + } +} diff --git a/plugins/markdown/plugin-markdown-stylize/src/node/options.ts b/plugins/markdown/plugin-markdown-stylize/src/node/options.ts new file mode 100644 index 0000000000..faccfb110c --- /dev/null +++ b/plugins/markdown/plugin-markdown-stylize/src/node/options.ts @@ -0,0 +1,65 @@ +import type { MarkdownItAttrsOptions } from '@mdit/plugin-attrs' +import type { MarkdownItStylizeConfig } from '@mdit/plugin-stylize' + +export interface MarkdownStylizePluginOptions { + /** + * Whether to enable align support + * + * 是否启用自定义对齐支持。 + * + * @default false + */ + align?: boolean + + /** + * Whether to enable attr support + * + * 是否启用属性支持。 + * + * @default false + */ + attrs?: MarkdownItAttrsOptions | boolean + + /** + * Whether to enable superscript format support + * + * 是否启用上角标格式支持。 + * + * @default false + */ + sup?: boolean + + /** + * Whether to enable subscript format support + * + * 是否启用下角标格式支持。 + * + * @default false + */ + sub?: boolean + + /** + * Whether to enable mark format support + * + * 是否启用标注支持。 + * + * @default false + */ + mark?: boolean + + /** + * Whether to enable spoiler support + * + * 是否启用剧透支持 + * + * @default false + */ + spoiler?: boolean + + /** + * Customizing token stylize + * + * 自定义标记样式 + */ + custom?: MarkdownItStylizeConfig[] +} diff --git a/plugins/markdown/plugin-markdown-stylize/src/node/prepareConfigFile.ts b/plugins/markdown/plugin-markdown-stylize/src/node/prepareConfigFile.ts new file mode 100644 index 0000000000..633ab32181 --- /dev/null +++ b/plugins/markdown/plugin-markdown-stylize/src/node/prepareConfigFile.ts @@ -0,0 +1,15 @@ +import { getRealPath } from '@vuepress/helper' +import type { App } from 'vuepress' + +const { url } = import.meta + +export const prepareConfigFile = ( + app: App, + { spoiler }: Record, +): Promise => + app.writeTemp( + `markdown-ext/config.js`, + `\ +${spoiler ? `import "${getRealPath('@mdit/plugin-spoiler/style', url)}"\n` : ''}\n +`, + ) diff --git a/plugins/markdown/plugin-markdown-stylize/tsconfig.build.json b/plugins/markdown/plugin-markdown-stylize/tsconfig.build.json new file mode 100644 index 0000000000..85b37d29a2 --- /dev/null +++ b/plugins/markdown/plugin-markdown-stylize/tsconfig.build.json @@ -0,0 +1,9 @@ +{ + "extends": "../../../tsconfig.build.json", + "compilerOptions": { + "rootDir": "./src", + "outDir": "./lib" + }, + "include": ["./src"], + "references": [{ "path": "../../../tools/helper/tsconfig.build.json" }] +} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index abdf37cea5..06fdde501f 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -158,6 +158,9 @@ importers: '@vuepress/plugin-markdown-math': specifier: workspace:* version: link:../plugins/markdown/plugin-markdown-math + '@vuepress/plugin-markdown-stylize': + specifier: workspace:* + version: link:../plugins/markdown/plugin-markdown-stylize '@vuepress/plugin-markdown-tab': specifier: workspace:* version: link:../plugins/markdown/plugin-markdown-tab @@ -745,6 +748,43 @@ importers: specifier: ^14.1.0 version: 14.1.0 + plugins/markdown/plugin-markdown-stylize: + dependencies: + '@mdit/plugin-align': + specifier: ^0.13.1 + version: 0.13.1(markdown-it@14.1.0) + '@mdit/plugin-attrs': + specifier: ^0.13.1 + version: 0.13.1(markdown-it@14.1.0) + '@mdit/plugin-mark': + specifier: ^0.13.1 + version: 0.13.1(markdown-it@14.1.0) + '@mdit/plugin-spoiler': + specifier: ^0.13.1 + version: 0.13.1(markdown-it@14.1.0) + '@mdit/plugin-stylize': + specifier: ^0.13.3 + version: 0.13.3(markdown-it@14.1.0) + '@mdit/plugin-sub': + specifier: ^0.13.1 + version: 0.13.1(markdown-it@14.1.0) + '@mdit/plugin-sup': + specifier: ^0.13.1 + version: 0.13.1(markdown-it@14.1.0) + '@types/markdown-it': + specifier: ^14.1.2 + version: 14.1.2 + '@vuepress/helper': + specifier: workspace:* + version: link:../../../tools/helper + vuepress: + specifier: 2.0.0-rc.18 + version: 2.0.0-rc.18(@vuepress/bundler-vite@2.0.0-rc.18(@types/node@22.7.7)(jiti@1.21.6)(lightningcss@1.27.0)(sass-embedded@1.80.3)(sass@1.80.3)(terser@5.36.0)(tsx@4.19.1)(typescript@5.6.3)(yaml@2.4.5))(@vuepress/bundler-webpack@2.0.0-rc.18(esbuild@0.23.1)(typescript@5.6.3))(typescript@5.6.3)(vue@3.5.12(typescript@5.6.3)) + devDependencies: + markdown-it: + specifier: ^14.1.0 + version: 14.1.0 + plugins/markdown/plugin-markdown-tab: dependencies: '@mdit/plugin-tab': @@ -2390,6 +2430,24 @@ packages: markdown-it: optional: true + '@mdit/plugin-align@0.13.1': + resolution: {integrity: sha512-g8je53oEpYNHEudhtB5ViSiAaiMcca+hvoGbInhLl979tWuvEosOs0oWH2X3GM4f6goTGx8gLwzA10Z5C4FxIQ==} + engines: {node: '>= 18'} + peerDependencies: + markdown-it: ^14.1.0 + peerDependenciesMeta: + markdown-it: + optional: true + + '@mdit/plugin-attrs@0.13.1': + resolution: {integrity: sha512-3saBw5W2y3T0QNbui+uk7nfD36FOoBWNQImk+pbMGpKRqunjouiYP4ZtnttT/AiieGbZBVaOqhM4e01Uyua8VA==} + engines: {node: '>= 18'} + peerDependencies: + markdown-it: ^14.1.0 + peerDependenciesMeta: + markdown-it: + optional: true + '@mdit/plugin-container@0.13.1': resolution: {integrity: sha512-mFfm7YViyLHo8uORVa9oLi9+acZZoSVdPf3WPqzC/yLZAJbF27rfJgWZ9Kylt+tyaAYng8L4DiSeVcSNUIHF1A==} engines: {node: '>= 18'} @@ -2453,6 +2511,15 @@ packages: markdown-it: optional: true + '@mdit/plugin-mark@0.13.1': + resolution: {integrity: sha512-UV+7cSY8iQXlfnrIJ/gEpgwiL2SSVzVLtaWMOV0J4tRSsdtN8ZXnJn/gC547SxBaOLIkt+0ObSskXaCH/UzuIA==} + engines: {node: '>= 18'} + peerDependencies: + markdown-it: ^14.1.0 + peerDependenciesMeta: + markdown-it: + optional: true + '@mdit/plugin-mathjax-slim@0.13.1': resolution: {integrity: sha512-ZFtKG2BtLAk1BarJZei9HP4aK0vNU7YvDb+R+nApK7MRmLQ53xHe7upu3qlfNBoOZWHXsdRmcz0G4xL3oxzlqA==} engines: {node: '>= 18'} @@ -2465,6 +2532,42 @@ packages: mathjax-full: optional: true + '@mdit/plugin-spoiler@0.13.1': + resolution: {integrity: sha512-6aOD+kjGavkn+Ta0Iq8AUfBG3UsKsL5e0pxi0Eng13lIEp8DrDw36W+E6fLOFtX8Te3ays6eTkTc1I5WzHO0Gw==} + engines: {node: '>= 18'} + peerDependencies: + markdown-it: ^14.1.0 + peerDependenciesMeta: + markdown-it: + optional: true + + '@mdit/plugin-stylize@0.13.3': + resolution: {integrity: sha512-+rNO8uDwtGkpGD7Xkz44wtkACrppKZK+Z5DWRHAyy1rMBlp6iUHn28fdR5Lw5dM05cTB23XjTHLViouOHhvhig==} + engines: {node: '>= 18'} + peerDependencies: + markdown-it: ^14.1.0 + peerDependenciesMeta: + markdown-it: + optional: true + + '@mdit/plugin-sub@0.13.1': + resolution: {integrity: sha512-2rIvEl6pXUoXIm3JMO5ZOQ+vWIeFXmLkqxcmTZB2yOIfhYdLwIcSyquRwtI2AX8zCuvaTdiQ/aypvIE4tDoURw==} + engines: {node: '>= 18'} + peerDependencies: + markdown-it: ^14.1.0 + peerDependenciesMeta: + markdown-it: + optional: true + + '@mdit/plugin-sup@0.13.1': + resolution: {integrity: sha512-vkNif2Rbj7/gtk4/HJt5hnb+Dcbnek/V4HtLdtqUUnq9bIbzFBpYw5jZ1ZKKZeetDtRvOUPH5oy5d7iXAHorUg==} + engines: {node: '>= 18'} + peerDependencies: + markdown-it: ^14.1.0 + peerDependenciesMeta: + markdown-it: + optional: true + '@mdit/plugin-tab@0.13.2': resolution: {integrity: sha512-evpIXvo6vXRWhgNE6vu4ok1I2dVOzrBYmBUGc1gW8nT9MvkW9litu7RbJ6CafscqaiiYRIM5Oib1ahS0lwte6g==} peerDependencies: @@ -2674,35 +2777,30 @@ packages: engines: {node: '>= 10.0.0'} cpu: [arm] os: [linux] - libc: [glibc] '@parcel/watcher-linux-arm64-glibc@2.4.1': resolution: {integrity: sha512-BJ7mH985OADVLpbrzCLgrJ3TOpiZggE9FMblfO65PlOCdG++xJpKUJ0Aol74ZUIYfb8WsRlUdgrZxKkz3zXWYA==} engines: {node: '>= 10.0.0'} cpu: [arm64] os: [linux] - libc: [glibc] '@parcel/watcher-linux-arm64-musl@2.4.1': resolution: {integrity: sha512-p4Xb7JGq3MLgAfYhslU2SjoV9G0kI0Xry0kuxeG/41UfpjHGOhv7UoUDAz/jb1u2elbhazy4rRBL8PegPJFBhA==} engines: {node: '>= 10.0.0'} cpu: [arm64] os: [linux] - libc: [musl] '@parcel/watcher-linux-x64-glibc@2.4.1': resolution: {integrity: sha512-s9O3fByZ/2pyYDPoLM6zt92yu6P4E39a03zvO0qCHOTjxmt3GHRMLuRZEWhWLASTMSrrnVNWdVI/+pUElJBBBg==} engines: {node: '>= 10.0.0'} cpu: [x64] os: [linux] - libc: [glibc] '@parcel/watcher-linux-x64-musl@2.4.1': resolution: {integrity: sha512-L2nZTYR1myLNST0O632g0Dx9LyMNHrn6TOt76sYxWLdff3cB22/GZX2UPtJnaqQPdCRoszoY5rcOj4oMTtp5fQ==} engines: {node: '>= 10.0.0'} cpu: [x64] os: [linux] - libc: [musl] '@parcel/watcher-win32-arm64@2.4.1': resolution: {integrity: sha512-Uq2BPp5GWhrq/lcuItCHoqxjULU1QYEcyjSO5jqqOK8RNFDBQnenMMx4gAl3v8GiWa59E9+uDM7yZ6LxwUIfRg==} @@ -2817,55 +2915,46 @@ packages: resolution: {integrity: sha512-0KXvIJQMOImLCVCz9uvvdPgfyWo93aHHp8ui3FrtOP57svqrF/roSSR5pjqL2hcMp0ljeGlU4q9o/rQaAQ3AYA==} cpu: [arm] os: [linux] - libc: [glibc] '@rollup/rollup-linux-arm-musleabihf@4.24.0': resolution: {integrity: sha512-it2BW6kKFVh8xk/BnHfakEeoLPv8STIISekpoF+nBgWM4d55CZKc7T4Dx1pEbTnYm/xEKMgy1MNtYuoA8RFIWw==} cpu: [arm] os: [linux] - libc: [musl] '@rollup/rollup-linux-arm64-gnu@4.24.0': resolution: {integrity: sha512-i0xTLXjqap2eRfulFVlSnM5dEbTVque/3Pi4g2y7cxrs7+a9De42z4XxKLYJ7+OhE3IgxvfQM7vQc43bwTgPwA==} cpu: [arm64] os: [linux] - libc: [glibc] '@rollup/rollup-linux-arm64-musl@4.24.0': resolution: {integrity: sha512-9E6MKUJhDuDh604Qco5yP/3qn3y7SLXYuiC0Rpr89aMScS2UAmK1wHP2b7KAa1nSjWJc/f/Lc0Wl1L47qjiyQw==} cpu: [arm64] os: [linux] - libc: [musl] '@rollup/rollup-linux-powerpc64le-gnu@4.24.0': resolution: {integrity: sha512-2XFFPJ2XMEiF5Zi2EBf4h73oR1V/lycirxZxHZNc93SqDN/IWhYYSYj8I9381ikUFXZrz2v7r2tOVk2NBwxrWw==} cpu: [ppc64] os: [linux] - libc: [glibc] '@rollup/rollup-linux-riscv64-gnu@4.24.0': resolution: {integrity: sha512-M3Dg4hlwuntUCdzU7KjYqbbd+BLq3JMAOhCKdBE3TcMGMZbKkDdJ5ivNdehOssMCIokNHFOsv7DO4rlEOfyKpg==} cpu: [riscv64] os: [linux] - libc: [glibc] '@rollup/rollup-linux-s390x-gnu@4.24.0': resolution: {integrity: sha512-mjBaoo4ocxJppTorZVKWFpy1bfFj9FeCMJqzlMQGjpNPY9JwQi7OuS1axzNIk0nMX6jSgy6ZURDZ2w0QW6D56g==} cpu: [s390x] os: [linux] - libc: [glibc] '@rollup/rollup-linux-x64-gnu@4.24.0': resolution: {integrity: sha512-ZXFk7M72R0YYFN5q13niV0B7G8/5dcQ9JDp8keJSfr3GoZeXEoMHP/HlvqROA3OMbMdfr19IjCeNAnPUG93b6A==} cpu: [x64] os: [linux] - libc: [glibc] '@rollup/rollup-linux-x64-musl@4.24.0': resolution: {integrity: sha512-w1i+L7kAXZNdYl+vFvzSZy8Y1arS7vMgIy8wusXJzRrPyof5LAb02KGr1PD2EkRcl73kHulIID0M501lN+vobQ==} cpu: [x64] os: [linux] - libc: [musl] '@rollup/rollup-win32-arm64-msvc@4.24.0': resolution: {integrity: sha512-VXBrnPWgBpVDCVY6XF3LEW0pOU51KbaHhccHw6AS6vBWIC60eqsH19DAeeObl+g8nKAz04QFdl/Cefta0xQtUQ==} @@ -5560,28 +5649,24 @@ packages: engines: {node: '>= 12.0.0'} cpu: [arm64] os: [linux] - libc: [glibc] lightningcss-linux-arm64-musl@1.27.0: resolution: {integrity: sha512-rCGBm2ax7kQ9pBSeITfCW9XSVF69VX+fm5DIpvDZQl4NnQoMQyRwhZQm9pd59m8leZ1IesRqWk2v/DntMo26lg==} engines: {node: '>= 12.0.0'} cpu: [arm64] os: [linux] - libc: [musl] lightningcss-linux-x64-gnu@1.27.0: resolution: {integrity: sha512-Dk/jovSI7qqhJDiUibvaikNKI2x6kWPN79AQiD/E/KeQWMjdGe9kw51RAgoWFDi0coP4jinaH14Nrt/J8z3U4A==} engines: {node: '>= 12.0.0'} cpu: [x64] os: [linux] - libc: [glibc] lightningcss-linux-x64-musl@1.27.0: resolution: {integrity: sha512-QKjTxXm8A9s6v9Tg3Fk0gscCQA1t/HMoF7Woy1u68wCk5kS4fR+q3vXa1p3++REW784cRAtkYKrPy6JKibrEZA==} engines: {node: '>= 12.0.0'} cpu: [x64] os: [linux] - libc: [musl] lightningcss-win32-arm64-msvc@1.27.0: resolution: {integrity: sha512-/wXegPS1hnhkeG4OXQKEMQeJd48RDC3qdh+OA8pCuOPCyvnm/yEayrJdJVqzBsqpy1aJklRCVxscpFur80o6iQ==} @@ -9765,6 +9850,19 @@ snapshots: optionalDependencies: markdown-it: 14.1.0 + '@mdit/plugin-align@0.13.1(markdown-it@14.1.0)': + dependencies: + '@mdit/plugin-container': 0.13.1(markdown-it@14.1.0) + '@types/markdown-it': 14.1.2 + optionalDependencies: + markdown-it: 14.1.0 + + '@mdit/plugin-attrs@0.13.1(markdown-it@14.1.0)': + dependencies: + '@types/markdown-it': 14.1.2 + optionalDependencies: + markdown-it: 14.1.0 + '@mdit/plugin-container@0.13.1(markdown-it@14.1.0)': dependencies: '@types/markdown-it': 14.1.2 @@ -9809,6 +9907,12 @@ snapshots: katex: 0.16.11 markdown-it: 14.1.0 + '@mdit/plugin-mark@0.13.1(markdown-it@14.1.0)': + dependencies: + '@types/markdown-it': 14.1.2 + optionalDependencies: + markdown-it: 14.1.0 + '@mdit/plugin-mathjax-slim@0.13.1(markdown-it@14.1.0)(mathjax-full@3.2.2)': dependencies: '@mdit/plugin-tex': 0.13.1(markdown-it@14.1.0) @@ -9818,6 +9922,30 @@ snapshots: markdown-it: 14.1.0 mathjax-full: 3.2.2 + '@mdit/plugin-spoiler@0.13.1(markdown-it@14.1.0)': + dependencies: + '@types/markdown-it': 14.1.2 + optionalDependencies: + markdown-it: 14.1.0 + + '@mdit/plugin-stylize@0.13.3(markdown-it@14.1.0)': + dependencies: + '@types/markdown-it': 14.1.2 + optionalDependencies: + markdown-it: 14.1.0 + + '@mdit/plugin-sub@0.13.1(markdown-it@14.1.0)': + dependencies: + '@types/markdown-it': 14.1.2 + optionalDependencies: + markdown-it: 14.1.0 + + '@mdit/plugin-sup@0.13.1(markdown-it@14.1.0)': + dependencies: + '@types/markdown-it': 14.1.2 + optionalDependencies: + markdown-it: 14.1.0 + '@mdit/plugin-tab@0.13.2(markdown-it@14.1.0)': dependencies: '@types/markdown-it': 14.1.2 diff --git a/tsconfig.build.json b/tsconfig.build.json index 1076a9fe3f..32e9c295ed 100644 --- a/tsconfig.build.json +++ b/tsconfig.build.json @@ -52,6 +52,9 @@ }, { "path": "./plugins/markdown/plugin-markdown-image/tsconfig.build.json" }, { "path": "./plugins/markdown/plugin-markdown-math/tsconfig.build.json" }, + { + "path": "./plugins/markdown/plugin-markdown-stylize/tsconfig.build.json" + }, { "path": "./plugins/markdown/plugin-markdown-tab/tsconfig.build.json" }, { "path": "./plugins/markdown/plugin-prismjs/tsconfig.build.json"