vuepress-plugin-md-power 1.0.0-rc.77 → 1.0.0-rc.79
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/lib/client/components/CodeEditor.vue +3 -1
- package/lib/client/components/CodeSandbox.vue +10 -3
- package/lib/node/features/codepen.js +9 -3
- package/lib/node/features/icons/writer.js +1 -1
- package/lib/node/features/langRepl.js +9 -3
- package/lib/node/features/video/bilibili.js +15 -5
- package/lib/node/features/video/youtube.js +12 -4
- package/lib/node/plugin.js +3 -1
- package/package.json +5 -5
|
@@ -48,7 +48,9 @@ function highlight() {
|
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
function updateScroll() {
|
|
51
|
-
|
|
51
|
+
if (container) {
|
|
52
|
+
container.scrollLeft = textAreaEl.value?.scrollLeft || 0
|
|
53
|
+
}
|
|
52
54
|
}
|
|
53
55
|
|
|
54
56
|
watch([input], highlight, { flush: 'post' })
|
|
@@ -11,12 +11,19 @@ const SANDBOX = 'allow-forms allow-modals allow-popups allow-presentation allow-
|
|
|
11
11
|
|
|
12
12
|
const source = computed(() => {
|
|
13
13
|
const params = new URLSearchParams()
|
|
14
|
-
|
|
14
|
+
if (props.filepath) {
|
|
15
|
+
params.set(props.type === 'embed' ? 'module' : 'file', encodeURIComponent(props.filepath))
|
|
16
|
+
}
|
|
15
17
|
|
|
16
18
|
if (props.type === 'embed') {
|
|
17
19
|
params.set('view', props.layout ? props.layout.replace(/,/g, '+') : 'Editor+Preview')
|
|
18
|
-
|
|
19
|
-
props.
|
|
20
|
+
|
|
21
|
+
if (props.console) {
|
|
22
|
+
params.set('expanddevtools', '1')
|
|
23
|
+
}
|
|
24
|
+
if (props.navbar === false) {
|
|
25
|
+
params.set('hidenavigation', '1')
|
|
26
|
+
}
|
|
20
27
|
}
|
|
21
28
|
else {
|
|
22
29
|
params.set('from-embed', '')
|
|
@@ -24,9 +24,15 @@ export const codepenPlugin = (md) => {
|
|
|
24
24
|
content: (meta) => {
|
|
25
25
|
const { title = 'Codepen', height, width } = meta;
|
|
26
26
|
const params = new URLSearchParams();
|
|
27
|
-
meta.editable
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
if (meta.editable) {
|
|
28
|
+
params.set('editable', 'true');
|
|
29
|
+
}
|
|
30
|
+
if (meta.tab) {
|
|
31
|
+
params.set('default-tab', meta.tab);
|
|
32
|
+
}
|
|
33
|
+
if (meta.theme) {
|
|
34
|
+
params.set('theme-id', meta.theme);
|
|
35
|
+
}
|
|
30
36
|
const middle = meta.preview ? '/embed/preview/' : '/embed/';
|
|
31
37
|
const link = `${CODEPEN_LINK}${meta.user}${middle}${meta.slash}?${params.toString()}`;
|
|
32
38
|
const style = `width:${width};height:${height};margin:16px auto;border-radius:5px;`;
|
|
@@ -102,7 +102,7 @@ async function genIconContent(iconName, cb) {
|
|
|
102
102
|
iconJson = JSON.parse(await fs.readFile(filename, 'utf-8'));
|
|
103
103
|
iconDataCache.set(collect, iconJson);
|
|
104
104
|
}
|
|
105
|
-
catch
|
|
105
|
+
catch {
|
|
106
106
|
logger.warn(`[plugin-md-power] Can not find icon, ${collect} is missing!`);
|
|
107
107
|
}
|
|
108
108
|
}
|
|
@@ -17,9 +17,15 @@ function createReplContainer(md, lang) {
|
|
|
17
17
|
md.use(container, type, { validate, render });
|
|
18
18
|
}
|
|
19
19
|
export async function langReplPlugin(app, md, { theme, go = false, kotlin = false, rust = false, }) {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
if (kotlin) {
|
|
21
|
+
createReplContainer(md, 'kotlin');
|
|
22
|
+
}
|
|
23
|
+
if (go) {
|
|
24
|
+
createReplContainer(md, 'go');
|
|
25
|
+
}
|
|
26
|
+
if (rust) {
|
|
27
|
+
createReplContainer(md, 'rust');
|
|
28
|
+
}
|
|
23
29
|
theme ??= { light: 'github-light', dark: 'github-dark' };
|
|
24
30
|
const data = { grammars: {} };
|
|
25
31
|
const themesPath = getDirname(import.meta.resolve('tm-themes'));
|
|
@@ -35,11 +35,21 @@ export const bilibiliPlugin = (md) => {
|
|
|
35
35
|
},
|
|
36
36
|
content(meta) {
|
|
37
37
|
const params = new URLSearchParams();
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
38
|
+
if (meta.bvid) {
|
|
39
|
+
params.set('bvid', meta.bvid);
|
|
40
|
+
}
|
|
41
|
+
if (meta.aid) {
|
|
42
|
+
params.set('aid', meta.aid);
|
|
43
|
+
}
|
|
44
|
+
if (meta.cid) {
|
|
45
|
+
params.set('cid', meta.cid);
|
|
46
|
+
}
|
|
47
|
+
if (meta.page) {
|
|
48
|
+
params.set('p', meta.page.toString());
|
|
49
|
+
}
|
|
50
|
+
if (meta.time) {
|
|
51
|
+
params.set('t', meta.time.toString());
|
|
52
|
+
}
|
|
43
53
|
params.set('autoplay', meta.autoplay ? '1' : '0');
|
|
44
54
|
const source = `${BILIBILI_LINK}?${params.toString()}`;
|
|
45
55
|
return `<VideoBilibili src="${source}" width="${meta.width}" height="${meta.height}" ratio="${meta.ratio}" title="${meta.title}" />`;
|
|
@@ -28,10 +28,18 @@ export const youtubePlugin = (md) => {
|
|
|
28
28
|
},
|
|
29
29
|
content(meta) {
|
|
30
30
|
const params = new URLSearchParams();
|
|
31
|
-
meta.autoplay
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
if (meta.autoplay) {
|
|
32
|
+
params.set('autoplay', '1');
|
|
33
|
+
}
|
|
34
|
+
if (meta.loop) {
|
|
35
|
+
params.set('loop', '1');
|
|
36
|
+
}
|
|
37
|
+
if (meta.start) {
|
|
38
|
+
params.set('start', meta.start.toString());
|
|
39
|
+
}
|
|
40
|
+
if (meta.end) {
|
|
41
|
+
params.set('end', meta.end.toString());
|
|
42
|
+
}
|
|
35
43
|
const source = `${YOUTUBE_LINK}/${meta.id}?${params.toString()}`;
|
|
36
44
|
return `<VideoYoutube src="${source}" width="${meta.width}" height="${meta.height}" ratio="${meta.ratio}" title="${meta.title}" />`;
|
|
37
45
|
},
|
package/lib/node/plugin.js
CHANGED
|
@@ -23,7 +23,9 @@ export function markdownPowerPlugin(options = {}) {
|
|
|
23
23
|
},
|
|
24
24
|
onInitialized: async () => await initIcon(),
|
|
25
25
|
extendsBundlerOptions(bundlerOptions) {
|
|
26
|
-
options.repl
|
|
26
|
+
if (options.repl) {
|
|
27
|
+
addViteOptimizeDepsInclude(bundlerOptions, app, ['shiki/core', 'shiki/wasm']);
|
|
28
|
+
}
|
|
27
29
|
},
|
|
28
30
|
extendsMarkdown: async (md, app) => {
|
|
29
31
|
if (options.caniuse) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vuepress-plugin-md-power",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.0-rc.
|
|
4
|
+
"version": "1.0.0-rc.79",
|
|
5
5
|
"description": "The Plugin for VuePress 2 - markdown power",
|
|
6
6
|
"author": "pengzhanbo <volodymyr@foxmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -41,18 +41,18 @@
|
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@iconify/utils": "^2.1.25",
|
|
44
|
-
"@vuepress/helper": "2.0.0-rc.
|
|
44
|
+
"@vuepress/helper": "2.0.0-rc.38",
|
|
45
45
|
"@vueuse/core": "^10.11.0",
|
|
46
46
|
"local-pkg": "^0.5.0",
|
|
47
47
|
"markdown-it-container": "^4.0.0",
|
|
48
48
|
"nanoid": "^5.0.7",
|
|
49
49
|
"shiki": "^1.10.3",
|
|
50
|
-
"tm-grammars": "^1.13.
|
|
51
|
-
"tm-themes": "^1.5.
|
|
50
|
+
"tm-grammars": "^1.13.11",
|
|
51
|
+
"tm-themes": "^1.5.3",
|
|
52
52
|
"vue": "^3.4.31"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
|
-
"@iconify/json": "^2.2.
|
|
55
|
+
"@iconify/json": "^2.2.228",
|
|
56
56
|
"@types/markdown-it": "^14.1.1"
|
|
57
57
|
},
|
|
58
58
|
"publishConfig": {
|