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.
@@ -48,7 +48,9 @@ function highlight() {
48
48
  }
49
49
 
50
50
  function updateScroll() {
51
- container && (container.scrollLeft = textAreaEl.value?.scrollLeft || 0)
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
- props.filepath && params.set(props.type === 'embed' ? 'module' : 'file', encodeURIComponent(props.filepath))
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
- props.console && params.set('expanddevtools', '1')
19
- props.navbar === false && params.set('hidenavigation', '1')
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 && params.set('editable', 'true');
28
- meta.tab && params.set('default-tab', meta.tab);
29
- meta.theme && params.set('theme-id', meta.theme);
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 (e) {
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
- kotlin && createReplContainer(md, 'kotlin');
21
- go && createReplContainer(md, 'go');
22
- rust && createReplContainer(md, 'rust');
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
- meta.bvid && params.set('bvid', meta.bvid);
39
- meta.aid && params.set('aid', meta.aid);
40
- meta.cid && params.set('cid', meta.cid);
41
- meta.page && params.set('p', meta.page.toString());
42
- meta.time && params.set('t', meta.time.toString());
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 && params.set('autoplay', '1');
32
- meta.loop && params.set('loop', '1');
33
- meta.start && params.set('start', meta.start.toString());
34
- meta.end && params.set('end', meta.end.toString());
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
  },
@@ -23,7 +23,9 @@ export function markdownPowerPlugin(options = {}) {
23
23
  },
24
24
  onInitialized: async () => await initIcon(),
25
25
  extendsBundlerOptions(bundlerOptions) {
26
- options.repl && addViteOptimizeDepsInclude(bundlerOptions, app, ['shiki/core', 'shiki/wasm']);
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.77",
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.37",
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.7",
51
- "tm-themes": "^1.5.1",
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.225",
55
+ "@iconify/json": "^2.2.228",
56
56
  "@types/markdown-it": "^14.1.1"
57
57
  },
58
58
  "publishConfig": {