vuepress-plugin-md-power 1.0.0-rc.100
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +239 -0
- package/lib/client/components/Bilibili.vue +45 -0
- package/lib/client/components/CanIUse.vue +94 -0
- package/lib/client/components/CodeEditor.vue +146 -0
- package/lib/client/components/CodeRepl.vue +242 -0
- package/lib/client/components/CodeSandbox.vue +75 -0
- package/lib/client/components/FileTreeItem.vue +169 -0
- package/lib/client/components/IconClose.vue +8 -0
- package/lib/client/components/IconConsole.vue +8 -0
- package/lib/client/components/IconRun.vue +8 -0
- package/lib/client/components/Loading.vue +44 -0
- package/lib/client/components/PDFViewer.vue +39 -0
- package/lib/client/components/Plot.vue +97 -0
- package/lib/client/components/Replit.vue +58 -0
- package/lib/client/components/Youtube.vue +41 -0
- package/lib/client/composables/codeRepl.d.ts +22 -0
- package/lib/client/composables/codeRepl.js +266 -0
- package/lib/client/composables/pdf.d.ts +19 -0
- package/lib/client/composables/pdf.js +59 -0
- package/lib/client/composables/rustRepl.d.ts +10 -0
- package/lib/client/composables/rustRepl.js +104 -0
- package/lib/client/composables/size.d.ts +26 -0
- package/lib/client/composables/size.js +37 -0
- package/lib/client/index.d.ts +1 -0
- package/lib/client/index.js +2 -0
- package/lib/client/options.d.ts +5 -0
- package/lib/client/options.js +5 -0
- package/lib/client/shim.d.ts +7 -0
- package/lib/client/utils/http.d.ts +6 -0
- package/lib/client/utils/http.js +25 -0
- package/lib/client/utils/is.d.ts +5 -0
- package/lib/client/utils/is.js +19 -0
- package/lib/client/utils/link.d.ts +3 -0
- package/lib/client/utils/link.js +9 -0
- package/lib/client/utils/sleep.d.ts +3 -0
- package/lib/client/utils/sleep.js +9 -0
- package/lib/node/index.d.ts +287 -0
- package/lib/node/index.js +1688 -0
- package/lib/node/markdown-it-container.d.ts +6 -0
- package/lib/shared/index.d.ts +277 -0
- package/lib/shared/index.js +0 -0
- package/package.json +65 -0
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
import { BuiltinTheme, ThemeRegistration } from 'shiki';
|
|
2
|
+
|
|
3
|
+
type CanIUseMode = 'embed' | 'image';
|
|
4
|
+
interface CanIUseTokenMeta {
|
|
5
|
+
feature: string;
|
|
6
|
+
mode: CanIUseMode;
|
|
7
|
+
versions: string;
|
|
8
|
+
}
|
|
9
|
+
interface CanIUseOptions {
|
|
10
|
+
/**
|
|
11
|
+
* 嵌入模式
|
|
12
|
+
*
|
|
13
|
+
* embed 通过iframe嵌入,提供可交互视图
|
|
14
|
+
*
|
|
15
|
+
* image 通过图片嵌入,静态
|
|
16
|
+
*
|
|
17
|
+
* @default 'embed'
|
|
18
|
+
*/
|
|
19
|
+
mode?: CanIUseMode;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
interface SizeOptions {
|
|
23
|
+
width?: string;
|
|
24
|
+
height?: string;
|
|
25
|
+
ratio?: number | string;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
interface CodepenTokenMeta extends SizeOptions {
|
|
29
|
+
title?: string;
|
|
30
|
+
user?: string;
|
|
31
|
+
slash?: string;
|
|
32
|
+
tab?: string;
|
|
33
|
+
theme?: string;
|
|
34
|
+
preview?: boolean;
|
|
35
|
+
editable?: boolean;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
interface CodeSandboxTokenMeta extends SizeOptions {
|
|
39
|
+
user?: string;
|
|
40
|
+
id?: string;
|
|
41
|
+
layout?: string;
|
|
42
|
+
type?: 'button' | 'embed';
|
|
43
|
+
title?: string;
|
|
44
|
+
filepath?: string;
|
|
45
|
+
navbar?: boolean;
|
|
46
|
+
console?: boolean;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
interface IconsOptions {
|
|
50
|
+
/**
|
|
51
|
+
* The prefix of the icon className
|
|
52
|
+
* @default 'vp-mdi'
|
|
53
|
+
*/
|
|
54
|
+
prefix?: string;
|
|
55
|
+
/**
|
|
56
|
+
* The size of the icon
|
|
57
|
+
* @default '1em'
|
|
58
|
+
*/
|
|
59
|
+
size?: string | number;
|
|
60
|
+
/**
|
|
61
|
+
* The color of the icon
|
|
62
|
+
* @default 'currentColor'
|
|
63
|
+
*/
|
|
64
|
+
color?: string;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
interface JSFiddleTokenMeta extends SizeOptions {
|
|
68
|
+
user?: string;
|
|
69
|
+
id?: string;
|
|
70
|
+
title?: string;
|
|
71
|
+
theme?: string;
|
|
72
|
+
tab?: string;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
type PDFEmbedType = 'iframe' | 'embed' | 'pdfjs';
|
|
76
|
+
interface PDFTokenMeta extends SizeOptions {
|
|
77
|
+
page?: number;
|
|
78
|
+
noToolbar?: boolean;
|
|
79
|
+
zoom?: number;
|
|
80
|
+
src?: string;
|
|
81
|
+
title?: string;
|
|
82
|
+
}
|
|
83
|
+
interface PDFOptions {
|
|
84
|
+
/**
|
|
85
|
+
* pdfjs url
|
|
86
|
+
*/
|
|
87
|
+
pdfjsUrl?: string;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
interface PlotOptions {
|
|
91
|
+
/**
|
|
92
|
+
* 是否启用 `=| |=` markdown (该标记为非标准标记,脱离插件将不生效)
|
|
93
|
+
* @default true
|
|
94
|
+
*/
|
|
95
|
+
tag?: boolean;
|
|
96
|
+
/**
|
|
97
|
+
* 遮罩层颜色
|
|
98
|
+
*/
|
|
99
|
+
mask?: string | {
|
|
100
|
+
light: string;
|
|
101
|
+
dark: string;
|
|
102
|
+
};
|
|
103
|
+
/**
|
|
104
|
+
* 文本颜色
|
|
105
|
+
*/
|
|
106
|
+
color?: string | {
|
|
107
|
+
light: string;
|
|
108
|
+
dark: string;
|
|
109
|
+
};
|
|
110
|
+
/**
|
|
111
|
+
* 触发方式
|
|
112
|
+
*
|
|
113
|
+
* @default 'hover'
|
|
114
|
+
*/
|
|
115
|
+
trigger?: 'hover' | 'click';
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
type ThemeOptions = BuiltinTheme | {
|
|
119
|
+
light: BuiltinTheme;
|
|
120
|
+
dark: BuiltinTheme;
|
|
121
|
+
};
|
|
122
|
+
interface ReplOptions {
|
|
123
|
+
theme?: ThemeOptions;
|
|
124
|
+
go?: boolean;
|
|
125
|
+
kotlin?: boolean;
|
|
126
|
+
rust?: boolean;
|
|
127
|
+
}
|
|
128
|
+
interface ReplEditorData {
|
|
129
|
+
grammars: {
|
|
130
|
+
go?: any;
|
|
131
|
+
kotlin?: any;
|
|
132
|
+
rust?: any;
|
|
133
|
+
};
|
|
134
|
+
theme: ThemeRegistration | {
|
|
135
|
+
light: ThemeRegistration;
|
|
136
|
+
dark: ThemeRegistration;
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
interface MarkdownPowerPluginOptions {
|
|
141
|
+
/**
|
|
142
|
+
* 是否启用 PDF 嵌入语法
|
|
143
|
+
*
|
|
144
|
+
* `@[pdf](pdf_url)`
|
|
145
|
+
*
|
|
146
|
+
* @default false
|
|
147
|
+
*/
|
|
148
|
+
pdf?: boolean | PDFOptions;
|
|
149
|
+
/**
|
|
150
|
+
* 是否启用 iconify 图标嵌入语法
|
|
151
|
+
*
|
|
152
|
+
* `:[collect:icon_name]:`
|
|
153
|
+
*
|
|
154
|
+
* @default false
|
|
155
|
+
*/
|
|
156
|
+
icons?: boolean | IconsOptions;
|
|
157
|
+
/**
|
|
158
|
+
* 是否启用 隐秘文本 语法
|
|
159
|
+
*
|
|
160
|
+
* `!!plot_content!!`
|
|
161
|
+
*
|
|
162
|
+
* @default false
|
|
163
|
+
*/
|
|
164
|
+
plot?: boolean | PlotOptions;
|
|
165
|
+
/**
|
|
166
|
+
* 是否启用 bilibili 视频嵌入
|
|
167
|
+
*
|
|
168
|
+
* `@[bilibili](bid)`
|
|
169
|
+
*
|
|
170
|
+
* @default false
|
|
171
|
+
*/
|
|
172
|
+
bilibili?: boolean;
|
|
173
|
+
/**
|
|
174
|
+
* 是否启用 youtube 视频嵌入
|
|
175
|
+
*
|
|
176
|
+
* `@[youtube](video_id)`
|
|
177
|
+
*
|
|
178
|
+
* @default false
|
|
179
|
+
*/
|
|
180
|
+
youtube?: boolean;
|
|
181
|
+
/**
|
|
182
|
+
* 是否启用 codepen 嵌入
|
|
183
|
+
*
|
|
184
|
+
* `@[codepen](pen_id)`
|
|
185
|
+
*
|
|
186
|
+
* @default false
|
|
187
|
+
*/
|
|
188
|
+
codepen?: boolean;
|
|
189
|
+
/**
|
|
190
|
+
* @deprecated
|
|
191
|
+
*/
|
|
192
|
+
replit?: boolean;
|
|
193
|
+
/**
|
|
194
|
+
* 是否启用 codeSandbox 嵌入
|
|
195
|
+
*
|
|
196
|
+
* `@[codesandbox](codesandbox_id)`
|
|
197
|
+
*
|
|
198
|
+
* @default false
|
|
199
|
+
*/
|
|
200
|
+
codeSandbox?: boolean;
|
|
201
|
+
/**
|
|
202
|
+
* 是否启用 jsfiddle 嵌入
|
|
203
|
+
*
|
|
204
|
+
* `@[jsfiddle](jsfiddle_id)`
|
|
205
|
+
*
|
|
206
|
+
* @default false
|
|
207
|
+
*/
|
|
208
|
+
jsfiddle?: boolean;
|
|
209
|
+
/**
|
|
210
|
+
* 是否启用 REPL 容器语法
|
|
211
|
+
*
|
|
212
|
+
* @default false
|
|
213
|
+
*/
|
|
214
|
+
repl?: false | ReplOptions;
|
|
215
|
+
/**
|
|
216
|
+
* 是否启用 文件树 容器语法
|
|
217
|
+
*
|
|
218
|
+
* @default false
|
|
219
|
+
*/
|
|
220
|
+
fileTree?: boolean;
|
|
221
|
+
/**
|
|
222
|
+
* 是否启用 caniuse 嵌入语法
|
|
223
|
+
*
|
|
224
|
+
* `@[caniuse](feature_name)`
|
|
225
|
+
*
|
|
226
|
+
* @default false
|
|
227
|
+
*/
|
|
228
|
+
caniuse?: boolean | CanIUseOptions;
|
|
229
|
+
/**
|
|
230
|
+
* 是否启用 自动填充 图片宽高属性
|
|
231
|
+
*
|
|
232
|
+
* __请注意,无论是否启用,该功能仅在构建生产包时生效__
|
|
233
|
+
*
|
|
234
|
+
* - 如果为 `true` ,等同于 `'local'`
|
|
235
|
+
* - 如果为 `local`,则仅对本地图片 添加 width 和 height
|
|
236
|
+
* - 如果为 `all`,则对所有图片(即包括 本地 和 远程) 添加 width 和 height
|
|
237
|
+
*
|
|
238
|
+
* 图片在加载过程中如果比较慢,从加载到完成的过程会导致页面布局不稳定,导致内容闪烁等。
|
|
239
|
+
* 此功能通过给图片添加 `width` 和 `height` 属性来解决该问题。
|
|
240
|
+
*
|
|
241
|
+
* 请谨慎使用 `all` 选项,该选项会在构建阶段发起网络请求,尝试加载远程图片以获取图片尺寸信息,
|
|
242
|
+
* 这可能会导致 构建时间变得更长(幸运的是获取尺寸信息只需要加载图片 几 KB 的数据包,因此耗时不会过长)
|
|
243
|
+
*
|
|
244
|
+
* @default false
|
|
245
|
+
*/
|
|
246
|
+
imageSize?: boolean | 'local' | 'all';
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
interface ReplitTokenMeta extends SizeOptions {
|
|
250
|
+
title?: string;
|
|
251
|
+
source?: string;
|
|
252
|
+
theme?: string;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
interface VideoOptions {
|
|
256
|
+
bilibili?: boolean;
|
|
257
|
+
youtube?: boolean;
|
|
258
|
+
}
|
|
259
|
+
interface BilibiliTokenMeta extends SizeOptions {
|
|
260
|
+
title?: string;
|
|
261
|
+
bvid?: string;
|
|
262
|
+
aid?: string;
|
|
263
|
+
cid?: string;
|
|
264
|
+
autoplay?: boolean;
|
|
265
|
+
time?: string | number;
|
|
266
|
+
page?: number;
|
|
267
|
+
}
|
|
268
|
+
interface YoutubeTokenMeta extends SizeOptions {
|
|
269
|
+
title?: string;
|
|
270
|
+
id: string;
|
|
271
|
+
autoplay?: boolean;
|
|
272
|
+
loop?: boolean;
|
|
273
|
+
start?: string | number;
|
|
274
|
+
end?: string | number;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
export type { BilibiliTokenMeta, CanIUseMode, CanIUseOptions, CanIUseTokenMeta, CodeSandboxTokenMeta, CodepenTokenMeta, IconsOptions, JSFiddleTokenMeta, MarkdownPowerPluginOptions, PDFEmbedType, PDFOptions, PDFTokenMeta, PlotOptions, ReplEditorData, ReplOptions, ReplitTokenMeta, SizeOptions, ThemeOptions, VideoOptions, YoutubeTokenMeta };
|
|
File without changes
|
package/package.json
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "vuepress-plugin-md-power",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "1.0.0-rc.100",
|
|
5
|
+
"description": "The Plugin for VuePress 2 - markdown power",
|
|
6
|
+
"author": "pengzhanbo <volodymyr@foxmail.com>",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"homepage": "https://github.com/pengzhanbo/vuepress-theme-plume#readme",
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+https://github.com/pengzhanbo/vuepress-theme-plume.git",
|
|
12
|
+
"directory": "plugins/plugin-md-power"
|
|
13
|
+
},
|
|
14
|
+
"bugs": {
|
|
15
|
+
"url": "https://github.com/pengzhanbo/vuepress-theme-plume/issues"
|
|
16
|
+
},
|
|
17
|
+
"exports": {
|
|
18
|
+
".": {
|
|
19
|
+
"types": "./lib/node/index.d.ts",
|
|
20
|
+
"import": "./lib/node/index.js"
|
|
21
|
+
},
|
|
22
|
+
"./client": {
|
|
23
|
+
"types": "./lib/client/index.d.ts",
|
|
24
|
+
"import": "./lib/client/index.js"
|
|
25
|
+
},
|
|
26
|
+
"./package.json": "./package.json"
|
|
27
|
+
},
|
|
28
|
+
"main": "lib/node/index.js",
|
|
29
|
+
"types": "./lib/node/index.d.ts",
|
|
30
|
+
"files": [
|
|
31
|
+
"lib"
|
|
32
|
+
],
|
|
33
|
+
"peerDependencies": {
|
|
34
|
+
"vuepress": "2.0.0-rc.15"
|
|
35
|
+
},
|
|
36
|
+
"dependencies": {
|
|
37
|
+
"@vuepress/helper": "2.0.0-rc.42",
|
|
38
|
+
"@vueuse/core": "^11.1.0",
|
|
39
|
+
"image-size": "^1.1.1",
|
|
40
|
+
"markdown-it-container": "^4.0.0",
|
|
41
|
+
"nanoid": "^5.0.7",
|
|
42
|
+
"shiki": "^1.17.7",
|
|
43
|
+
"tm-grammars": "^1.17.22",
|
|
44
|
+
"tm-themes": "^1.8.2",
|
|
45
|
+
"vue": "^3.5.6"
|
|
46
|
+
},
|
|
47
|
+
"devDependencies": {
|
|
48
|
+
"@types/markdown-it": "^14.1.2"
|
|
49
|
+
},
|
|
50
|
+
"publishConfig": {
|
|
51
|
+
"access": "public"
|
|
52
|
+
},
|
|
53
|
+
"keyword": [
|
|
54
|
+
"VuePress",
|
|
55
|
+
"vuepress plugin",
|
|
56
|
+
"markdown power",
|
|
57
|
+
"vuepress-plugin-md-power"
|
|
58
|
+
],
|
|
59
|
+
"scripts": {
|
|
60
|
+
"build": "pnpm copy && pnpm tsup",
|
|
61
|
+
"clean": "rimraf --glob ./lib",
|
|
62
|
+
"copy": "cpx \"src/**/*.{d.ts,vue,css,scss,jpg,png}\" lib",
|
|
63
|
+
"tsup": "tsup --config tsup.config.ts"
|
|
64
|
+
}
|
|
65
|
+
}
|