vuepress-plugin-md-power 1.0.0-rc.154 → 1.0.0-rc.155

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.
@@ -16,7 +16,7 @@ const activeFileTreeNode = inject<Ref<string>>('active-file-tree-node', ref(''))
16
16
 
17
17
  const onNodeClick = inject<
18
18
  (filename: string, type: 'file' | 'folder') => void
19
- >('on-file-tree-node-click', () => {})
19
+ >('on-file-tree-node-click', () => {})
20
20
 
21
21
  const active = ref(props.expanded)
22
22
 
@@ -4,15 +4,17 @@ defineProps<{
4
4
  type?: string
5
5
  required?: boolean
6
6
  optional?: boolean
7
+ deprecated?: boolean
7
8
  defaultValue?: string
8
9
  }>()
9
10
  </script>
10
11
 
11
12
  <template>
12
- <div class="vp-field">
13
+ <div class="vp-field" :class="{ required, optional, deprecated }">
13
14
  <p class="field-meta">
14
15
  <span class="name">{{ name }}</span>
15
16
  <span v-if="required || optional" :class="{ required, optional }">{{ required ? 'Required' : optional ? 'Optional' : '' }}</span>
17
+ <span v-if="deprecated" class="deprecated">Deprecated</span>
16
18
  <span v-if="type" class="type"><code>{{ type }}</code></span>
17
19
  </p>
18
20
  <p v-if="defaultValue" class="default-value">
@@ -48,8 +50,13 @@ defineProps<{
48
50
  font-weight: 500;
49
51
  }
50
52
 
53
+ .vp-field.deprecated .field-meta .name {
54
+ text-decoration: line-through;
55
+ }
56
+
51
57
  .vp-field .field-meta .required,
52
- .vp-field .field-meta .optional {
58
+ .vp-field .field-meta .optional,
59
+ .vp-field .field-meta .deprecated {
53
60
  display: inline-block;
54
61
  padding: 2px 8px;
55
62
  font-size: 12px;
@@ -68,6 +75,11 @@ defineProps<{
68
75
  border: solid 1px var(--vp-c-divider);
69
76
  }
70
77
 
78
+ .vp-field .field-meta .deprecated {
79
+ color: var(--vp-c-danger-2);
80
+ border: solid 1px var(--vp-c-danger-2);
81
+ }
82
+
71
83
  .vp-field .field-meta .type {
72
84
  flex: 1 2;
73
85
  text-align: right;
@@ -76,7 +88,8 @@ defineProps<{
76
88
  .vp-field .default-value {
77
89
  margin: 0;
78
90
  font-size: 14px;
79
- line-height: 1;
91
+ line-height: 1.7;
92
+ transform: translateY(-4px);
80
93
  }
81
94
 
82
95
  .vp-field .description :where(p, ul, ol) {
@@ -5,6 +5,7 @@ import { useSize } from '../composables/size.js'
5
5
  const props = defineProps<{
6
6
  src: string
7
7
  title: string
8
+ type?: string
8
9
  width?: string
9
10
  height?: string
10
11
  ratio?: string
@@ -21,9 +22,9 @@ const { el, width, height, resize } = useSize(options)
21
22
  <ClientOnly>
22
23
  <iframe
23
24
  ref="el"
24
- class="video-youtube-iframe"
25
+ class="video-iframe" :class="type"
25
26
  :src="src"
26
- :title="title || 'Youtube'"
27
+ :title="title || type"
27
28
  :style="{ width, height }"
28
29
  :allow="IFRAME_ALLOW"
29
30
  @load="resize"
@@ -32,7 +33,7 @@ const { el, width, height, resize } = useSize(options)
32
33
  </template>
33
34
 
34
35
  <style>
35
- .video-youtube-iframe {
36
+ .video-iframe {
36
37
  width: 100%;
37
38
  margin: 16px auto;
38
39
  border: none;
@@ -348,6 +348,14 @@ interface MarkdownPowerPluginOptions {
348
348
  field?: boolean;
349
349
  // video embed
350
350
  /**
351
+ * 是否启用 acfun 视频嵌入
352
+ *
353
+ * `@[acfun](acid)`
354
+ *
355
+ * @default false
356
+ */
357
+ acfun?: boolean;
358
+ /**
351
359
  * 是否启用 bilibili 视频嵌入
352
360
  *
353
361
  * `@[bilibili](bid)`
@@ -476,6 +484,10 @@ interface VideoOptions {
476
484
  bilibili?: boolean;
477
485
  youtube?: boolean;
478
486
  }
487
+ interface AcFunTokenMeta extends SizeOptions {
488
+ title?: string;
489
+ id: string;
490
+ }
479
491
  interface BilibiliTokenMeta extends SizeOptions {
480
492
  title?: string;
481
493
  bvid?: string;
@@ -517,4 +529,4 @@ declare function resolveImageSize(app: App, url: string, remote?: boolean): Prom
517
529
  //#region src/node/plugin.d.ts
518
530
  declare function markdownPowerPlugin(options?: MarkdownPowerPluginOptions): Plugin;
519
531
  //#endregion
520
- export { ArtPlayerTokenMeta, BilibiliTokenMeta, CanIUseMode, CanIUseOptions, CanIUseTokenMeta, CodeSandboxTokenMeta, CodeTabsOptions, CodepenTokenMeta, DemoContainerRender, DemoFile, DemoMeta, FileTreeIconMode, FileTreeOptions, FontAwesomeAssetBuiltIn, FontAwesomePrefix, FontAwesomeProvider, IconAssetLink, IconFontProvider, IconOptions, IconProviderBase, IconifyPrefix, IconifyProvider, JSFiddleTokenMeta, LiteralUnion, MarkdownDemoEnv, MarkdownPowerPluginOptions, NpmToOptions, NpmToPackageManager, PDFEmbedType, PDFOptions, PDFTokenMeta, PlotOptions, ReplEditorData, ReplOptions, ReplitTokenMeta, SizeOptions, ThemeOptions, VideoOptions, YoutubeTokenMeta, createCodeTabIconGetter, markdownPowerPlugin, resolveImageSize };
532
+ export { AcFunTokenMeta, ArtPlayerTokenMeta, BilibiliTokenMeta, CanIUseMode, CanIUseOptions, CanIUseTokenMeta, CodeSandboxTokenMeta, CodeTabsOptions, CodepenTokenMeta, DemoContainerRender, DemoFile, DemoMeta, FileTreeIconMode, FileTreeOptions, FontAwesomeAssetBuiltIn, FontAwesomePrefix, FontAwesomeProvider, IconAssetLink, IconFontProvider, IconOptions, IconProviderBase, IconifyPrefix, IconifyProvider, JSFiddleTokenMeta, LiteralUnion, MarkdownDemoEnv, MarkdownPowerPluginOptions, NpmToOptions, NpmToPackageManager, PDFEmbedType, PDFOptions, PDFTokenMeta, PlotOptions, ReplEditorData, ReplOptions, ReplitTokenMeta, SizeOptions, ThemeOptions, VideoOptions, YoutubeTokenMeta, createCodeTabIconGetter, markdownPowerPlugin, resolveImageSize };
package/lib/node/index.js CHANGED
@@ -17,6 +17,8 @@ import { isPackageExists, resolveModule } from "local-pkg";
17
17
  import { LRUCache } from "lru-cache";
18
18
  import { watch } from "chokidar";
19
19
  import { customAlphabet } from "nanoid";
20
+ import { removeLeadingSlash as removeLeadingSlash$1 } from "@vuepress/shared";
21
+ import { path as path$2 } from "@vuepress/utils";
20
22
  import { attrs } from "@mdit/plugin-attrs";
21
23
  import { footnote } from "@mdit/plugin-footnote";
22
24
  import { mark } from "@mdit/plugin-mark";
@@ -968,7 +970,7 @@ function resolveAttrs(info) {
968
970
  };
969
971
  }
970
972
  function resolveAttr(info, key) {
971
- const pattern = new RegExp(`(?:^|\\s+)${key}(?:=(?<quote>['"])(?<valueWithQuote>.+?)\\k<quote>|=(?<valueWithoutQuote>\\S+))?(?:\\s+|$)`);
973
+ const pattern = /* @__PURE__ */ new RegExp(`(?:^|\\s+)${key}(?:=(?<quote>['"])(?<valueWithQuote>.+?)\\k<quote>|=(?<valueWithoutQuote>\\S+))?(?:\\s+|$)`);
972
974
  const groups = info.match(pattern)?.groups;
973
975
  return groups?.valueWithQuote || groups?.valueWithoutQuote;
974
976
  }
@@ -1151,13 +1153,13 @@ async function resolveImageSize(app, url, remote = false) {
1151
1153
  if (isLinkHttp(url) && remote) return await fetchImageSize(url);
1152
1154
  if (url[0] === "/") {
1153
1155
  const filepath$1 = app.dir.public(url.slice(1));
1154
- if (fs.existsSync(filepath$1)) {
1156
+ if (fs.existsSync(filepath$1)) try {
1155
1157
  const { width, height } = imageSize(fs.readFileSync(filepath$1));
1156
1158
  return {
1157
1159
  width,
1158
1160
  height
1159
1161
  };
1160
- }
1162
+ } catch {}
1161
1163
  }
1162
1164
  return {
1163
1165
  width: 0,
@@ -1753,11 +1755,12 @@ function fieldPlugin(md) {
1753
1755
  createContainerPlugin(md, "field", {
1754
1756
  before: (info) => {
1755
1757
  const { attrs: attrs$1 } = resolveAttrs(info);
1756
- const { name, type, required, optional, default: defaultValue } = attrs$1;
1758
+ const { name, type, required, optional, deprecated, default: defaultValue } = attrs$1;
1757
1759
  const props = stringifyAttrs({
1758
1760
  name,
1759
1761
  required,
1760
- optional
1762
+ optional,
1763
+ deprecated
1761
1764
  });
1762
1765
  return `<VPField${props}${!isUndefined(type) ? ` type="${type}"` : ""}${!isUndefined(defaultValue) ? ` default-value="${defaultValue}"` : ""}>`;
1763
1766
  },
@@ -2674,8 +2677,8 @@ function importer(func) {
2674
2677
  //#endregion
2675
2678
  //#region src/node/demo/supports/insertScript.ts
2676
2679
  const SCRIPT_RE$1 = /<script.*?>/;
2677
- function insertSetupScript({ export: name, path: path$2 }, env) {
2678
- const imports = `import ${name ? `${name} from ` : ""}'${path$2}';`;
2680
+ function insertSetupScript({ export: name, path: path$3 }, env) {
2681
+ const imports = `import ${name ? `${name} from ` : ""}'${path$3}';`;
2679
2682
  const scriptSetup = env.sfcBlocks.scriptSetup ??= {
2680
2683
  type: "script",
2681
2684
  content: "<script setup>\n</script>",
@@ -2723,39 +2726,39 @@ const tasks = {};
2723
2726
  const target$2 = "md-power/demo/watcher.txt";
2724
2727
  function demoWatcher(app, watchers) {
2725
2728
  if (!watcher) watcher = watch([], { ignoreInitial: true });
2726
- Object.keys(tasks).forEach((path$2) => {
2727
- watcher.add(path$2);
2729
+ Object.keys(tasks).forEach((path$3) => {
2730
+ watcher.add(path$3);
2728
2731
  });
2729
2732
  const code = readFileSync(app.dir.temp(target$2));
2730
2733
  if (code) {
2731
2734
  const paths = JSON.parse(code || "{}");
2732
- Object.entries(paths).forEach(([path$2, output]) => {
2733
- watcher.add(path$2);
2734
- tasks[path$2] = output;
2735
+ Object.entries(paths).forEach(([path$3, output]) => {
2736
+ watcher.add(path$3);
2737
+ tasks[path$3] = output;
2735
2738
  });
2736
2739
  }
2737
2740
  updateWatchFiles(app);
2738
- watcher.on("change", (path$2) => {
2739
- if (tasks[path$2]) {
2740
- const code$1 = readFileSync(path$2);
2741
+ watcher.on("change", (path$3) => {
2742
+ if (tasks[path$3]) {
2743
+ const code$1 = readFileSync(path$3);
2741
2744
  if (code$1 === false) return;
2742
2745
  const source = parseEmbedCode(code$1);
2743
- compileCode(source, tasks[path$2]);
2746
+ compileCode(source, tasks[path$3]);
2744
2747
  }
2745
2748
  });
2746
- watcher.on("unlink", (path$2) => {
2747
- delete tasks[path$2];
2748
- watcher.unwatch(path$2);
2749
+ watcher.on("unlink", (path$3) => {
2750
+ delete tasks[path$3];
2751
+ watcher.unwatch(path$3);
2749
2752
  });
2750
2753
  watchers.push({ close: () => {
2751
2754
  watcher.close();
2752
2755
  watcher = null;
2753
2756
  } });
2754
2757
  }
2755
- function addTask(app, path$2, output) {
2756
- if (tasks[path$2]) return;
2757
- tasks[path$2] = output;
2758
- if (watcher) watcher.add(path$2);
2758
+ function addTask(app, path$3, output) {
2759
+ if (tasks[path$3]) return;
2760
+ tasks[path$3] = output;
2761
+ if (watcher) watcher.add(path$3);
2759
2762
  updateWatchFiles(app);
2760
2763
  }
2761
2764
  async function updateWatchFiles(app) {
@@ -3168,8 +3171,8 @@ function getContainerMeta(info) {
3168
3171
  function extendsPageWithDemo(page) {
3169
3172
  const markdownEnv = page.markdownEnv;
3170
3173
  const demoFiles = markdownEnv.demoFiles ?? [];
3171
- page.deps.push(...demoFiles.filter(({ type }) => type === "markdown").map(({ path: path$2 }) => path$2));
3172
- (page.frontmatter.gitInclude ??= []).push(...demoFiles.filter(({ gitignore }) => !gitignore).map(({ path: path$2 }) => path$2));
3174
+ page.deps.push(...demoFiles.filter(({ type }) => type === "markdown").map(({ path: path$3 }) => path$3));
3175
+ (page.frontmatter.gitInclude ??= []).push(...demoFiles.filter(({ gitignore }) => !gitignore).map(({ path: path$3 }) => path$3));
3173
3176
  }
3174
3177
 
3175
3178
  //#endregion
@@ -3436,6 +3439,39 @@ const pdfPlugin = (md) => {
3436
3439
  });
3437
3440
  };
3438
3441
 
3442
+ //#endregion
3443
+ //#region src/node/embed/video/acfun.ts
3444
+ const AC_FUN_LINK = "https://www.acfun.cn/player";
3445
+ const acfunPlugin = (md) => {
3446
+ createEmbedRuleBlock(md, {
3447
+ type: "acfun",
3448
+ name: "video_acfun",
3449
+ syntaxPattern: /^@\[acfun([^\]]*)\]\(([^)]*)\)/,
3450
+ meta([, info, id]) {
3451
+ const { attrs: attrs$1 } = resolveAttrs(info);
3452
+ return {
3453
+ id,
3454
+ title: attrs$1.title || "AcFun",
3455
+ width: attrs$1.width ? parseRect(attrs$1.width) : "100%",
3456
+ height: attrs$1.height ? parseRect(attrs$1.height) : void 0,
3457
+ ratio: attrs$1.ratio ?? "16:10"
3458
+ };
3459
+ },
3460
+ content(meta) {
3461
+ const { id, width, height, ratio, title } = meta;
3462
+ const src = `${AC_FUN_LINK}/${id}`;
3463
+ return `<VPVideoEmbed${stringifyAttrs({
3464
+ src,
3465
+ width,
3466
+ height,
3467
+ ratio,
3468
+ title,
3469
+ type: "acfun"
3470
+ })} />`;
3471
+ }
3472
+ });
3473
+ };
3474
+
3439
3475
  //#endregion
3440
3476
  //#region src/node/embed/video/artPlayer.ts
3441
3477
  const installed = {
@@ -3540,10 +3576,10 @@ const bilibiliPlugin = (md) => {
3540
3576
  cid,
3541
3577
  autoplay: attrs$1.autoplay ?? false,
3542
3578
  time: timeToSeconds(attrs$1.time),
3543
- title: attrs$1.title,
3579
+ title: attrs$1.title || "Bilibili",
3544
3580
  width: attrs$1.width ? parseRect(attrs$1.width) : "100%",
3545
3581
  height: attrs$1.height ? parseRect(attrs$1.height) : void 0,
3546
- ratio: attrs$1.ratio ? parseRect(attrs$1.ratio) : void 0
3582
+ ratio: attrs$1.ratio
3547
3583
  };
3548
3584
  },
3549
3585
  content(meta) {
@@ -3555,14 +3591,15 @@ const bilibiliPlugin = (md) => {
3555
3591
  if (meta.time) params.set("t", meta.time.toString());
3556
3592
  params.set("autoplay", meta.autoplay ? "1" : "0");
3557
3593
  params.set("high_quality", "1");
3558
- const source = `${BILIBILI_LINK}?${params.toString()}`;
3594
+ const src = `${BILIBILI_LINK}?${params.toString()}`;
3559
3595
  const { width, height, ratio, title } = meta;
3560
- return `<VideoBilibili${stringifyAttrs({
3561
- src: source,
3596
+ return `<VPVideoEmbed${stringifyAttrs({
3597
+ src,
3562
3598
  width,
3563
3599
  height,
3564
3600
  ratio,
3565
- title
3601
+ title,
3602
+ type: "bilibili"
3566
3603
  })} />`;
3567
3604
  }
3568
3605
  });
@@ -3584,10 +3621,10 @@ const youtubePlugin = (md) => {
3584
3621
  loop: attrs$1.loop ?? false,
3585
3622
  start: timeToSeconds(attrs$1.start),
3586
3623
  end: timeToSeconds(attrs$1.end),
3587
- title: attrs$1.title,
3624
+ title: attrs$1.title || "YouTube",
3588
3625
  width: attrs$1.width ? parseRect(attrs$1.width) : "100%",
3589
3626
  height: attrs$1.height ? parseRect(attrs$1.height) : void 0,
3590
- ratio: attrs$1.ratio ? parseRect(attrs$1.ratio) : void 0
3627
+ ratio: attrs$1.ratio
3591
3628
  };
3592
3629
  },
3593
3630
  content(meta) {
@@ -3596,14 +3633,15 @@ const youtubePlugin = (md) => {
3596
3633
  if (meta.loop) params.set("loop", "1");
3597
3634
  if (meta.start) params.set("start", meta.start.toString());
3598
3635
  if (meta.end) params.set("end", meta.end.toString());
3599
- const source = `${YOUTUBE_LINK}/${meta.id}?${params.toString()}`;
3636
+ const src = `${YOUTUBE_LINK}/${meta.id}?${params.toString()}`;
3600
3637
  const { width, height, ratio, title } = meta;
3601
- return `<VideoYoutube${stringifyAttrs({
3602
- src: source,
3638
+ return `<VPVideoEmbed${stringifyAttrs({
3639
+ src,
3603
3640
  width,
3604
3641
  height,
3605
3642
  ratio,
3606
- title
3643
+ title,
3644
+ type: "youtube"
3607
3645
  })} />`;
3608
3646
  }
3609
3647
  });
@@ -3618,6 +3656,7 @@ function embedSyntaxPlugin(md, options) {
3618
3656
  legacyCaniuse(md, caniuse);
3619
3657
  }
3620
3658
  if (options.pdf) md.use(pdfPlugin);
3659
+ if (options.acfun) md.use(acfunPlugin);
3621
3660
  if (options.bilibili) md.use(bilibiliPlugin);
3622
3661
  if (options.youtube) md.use(youtubePlugin);
3623
3662
  if (options.artPlayer) md.use(artPlayerPlugin);
@@ -3662,7 +3701,7 @@ function parseSource(source) {
3662
3701
  };
3663
3702
  else {
3664
3703
  const end = source.indexOf(`\n${char}`);
3665
- const len = char.length + 1;
3704
+ const len = 4;
3666
3705
  return {
3667
3706
  matter: source.slice(0, end + len),
3668
3707
  content: source.slice(end + len)
@@ -3679,7 +3718,7 @@ function linksPlugin(md) {
3679
3718
  };
3680
3719
  let hasOpenInternalLink = false;
3681
3720
  const internalTag = "VPLink";
3682
- function handleLinkOpen(tokens, idx) {
3721
+ function handleLinkOpen(tokens, idx, env) {
3683
3722
  hasOpenInternalLink = false;
3684
3723
  const token = tokens[idx];
3685
3724
  const hrefIndex = token.attrIndex("href");
@@ -3696,9 +3735,19 @@ function linksPlugin(md) {
3696
3735
  if (hrefLink[0] === "#") return;
3697
3736
  hasOpenInternalLink = true;
3698
3737
  token.tag = internalTag;
3738
+ const matched = hrefLink.match(/^([^#?]*?(?:\/|\.md|\.html))([#?].*)?$/);
3739
+ if (matched) {
3740
+ const rawPath = matched[1];
3741
+ const { absolutePath, relativePath } = resolvePaths(rawPath, env.base || "/", env.filePathRelative ?? null);
3742
+ (env.links ??= []).push({
3743
+ raw: rawPath,
3744
+ absolute: absolutePath,
3745
+ relative: relativePath
3746
+ });
3747
+ }
3699
3748
  }
3700
3749
  md.renderer.rules.link_open = (tokens, idx, opts, env, self) => {
3701
- handleLinkOpen(tokens, idx);
3750
+ handleLinkOpen(tokens, idx, env);
3702
3751
  return self.renderToken(tokens, idx, opts);
3703
3752
  };
3704
3753
  md.renderer.rules.link_close = (tokens, idx, opts, _env, self) => {
@@ -3709,6 +3758,31 @@ function linksPlugin(md) {
3709
3758
  return self.renderToken(tokens, idx, opts);
3710
3759
  };
3711
3760
  }
3761
+ /**
3762
+ * Resolve relative and absolute paths according to the `base` and `filePathRelative`
3763
+ */
3764
+ function resolvePaths(rawPath, base, filePathRelative) {
3765
+ let absolutePath;
3766
+ let relativePath;
3767
+ if (rawPath.startsWith("/")) if (rawPath.endsWith(".md")) {
3768
+ absolutePath = path$2.join(base, rawPath);
3769
+ relativePath = removeLeadingSlash$1(rawPath);
3770
+ } else {
3771
+ absolutePath = rawPath;
3772
+ relativePath = path$2.relative(base, absolutePath);
3773
+ }
3774
+ else if (filePathRelative) {
3775
+ relativePath = path$2.join(path$2.dirname(encodeURI(filePathRelative)), rawPath);
3776
+ absolutePath = path$2.join(base, relativePath);
3777
+ } else {
3778
+ relativePath = rawPath.replace(/^(?:\.\/)?(.*)$/, "$1");
3779
+ absolutePath = null;
3780
+ }
3781
+ return {
3782
+ absolutePath,
3783
+ relativePath
3784
+ };
3785
+ }
3712
3786
 
3713
3787
  //#endregion
3714
3788
  //#region src/node/icon/createIconRule.ts
@@ -3925,7 +3999,7 @@ const abbrPlugin = (md) => {
3925
3999
  const { abbreviations } = state.env;
3926
4000
  if (!abbreviations) return;
3927
4001
  const abbreviationsRegExpText = Object.keys(abbreviations).map((x) => x.substring(1)).sort((a, b) => b.length - a.length).map(escapeRE).join("|");
3928
- const regexpSimple = new RegExp(`(?:${abbreviationsRegExpText})`);
4002
+ const regexpSimple = /* @__PURE__ */ new RegExp(`(?:${abbreviationsRegExpText})`);
3929
4003
  const regExp = new RegExp(`(^|${WORDING_REGEXP_TEXT})(${abbreviationsRegExpText})($|${WORDING_REGEXP_TEXT})`, "g");
3930
4004
  for (const token of tokens) {
3931
4005
  if (token.type !== "inline") continue;
@@ -4128,13 +4202,9 @@ async function prepareConfigFile(app, options) {
4128
4202
  imports.add(`import PDFViewer from '${CLIENT_FOLDER}components/PDFViewer.vue'`);
4129
4203
  enhances.add(`app.component('PDFViewer', PDFViewer)`);
4130
4204
  }
4131
- if (options.bilibili) {
4132
- imports.add(`import Bilibili from '${CLIENT_FOLDER}components/Bilibili.vue'`);
4133
- enhances.add(`app.component('VideoBilibili', Bilibili)`);
4134
- }
4135
- if (options.youtube) {
4136
- imports.add(`import Youtube from '${CLIENT_FOLDER}components/Youtube.vue'`);
4137
- enhances.add(`app.component('VideoYoutube', Youtube)`);
4205
+ if (options.acfun || options.bilibili || options.youtube) {
4206
+ imports.add(`import VPVideoEmbed from '${CLIENT_FOLDER}components/VPVideoEmbed.vue'`);
4207
+ enhances.add(`app.component('VPVideoEmbed', VPVideoEmbed)`);
4138
4208
  }
4139
4209
  if (options.codepen) {
4140
4210
  imports.add(`import CodePen from '${CLIENT_FOLDER}components/CodePen.vue'`);
@@ -346,6 +346,14 @@ interface MarkdownPowerPluginOptions {
346
346
  field?: boolean;
347
347
  // video embed
348
348
  /**
349
+ * 是否启用 acfun 视频嵌入
350
+ *
351
+ * `@[acfun](acid)`
352
+ *
353
+ * @default false
354
+ */
355
+ acfun?: boolean;
356
+ /**
349
357
  * 是否启用 bilibili 视频嵌入
350
358
  *
351
359
  * `@[bilibili](bid)`
@@ -474,6 +482,10 @@ interface VideoOptions {
474
482
  bilibili?: boolean;
475
483
  youtube?: boolean;
476
484
  }
485
+ interface AcFunTokenMeta extends SizeOptions {
486
+ title?: string;
487
+ id: string;
488
+ }
477
489
  interface BilibiliTokenMeta extends SizeOptions {
478
490
  title?: string;
479
491
  bvid?: string;
@@ -502,4 +514,4 @@ interface ArtPlayerTokenMeta extends SizeOptions {
502
514
  type?: string;
503
515
  }
504
516
  //#endregion
505
- export { ArtPlayerTokenMeta, BilibiliTokenMeta, CanIUseMode, CanIUseOptions, CanIUseTokenMeta, CodeSandboxTokenMeta, CodeTabsOptions, CodepenTokenMeta, DemoContainerRender, DemoFile, DemoMeta, FileTreeIconMode, FileTreeOptions, FontAwesomeAssetBuiltIn, FontAwesomePrefix, FontAwesomeProvider, IconAssetLink, IconFontProvider, IconOptions, IconProviderBase, IconifyPrefix, IconifyProvider, JSFiddleTokenMeta, LiteralUnion, MarkdownDemoEnv, MarkdownPowerPluginOptions, NpmToOptions, NpmToPackageManager, PDFEmbedType, PDFOptions, PDFTokenMeta, PlotOptions, ReplEditorData, ReplOptions, ReplitTokenMeta, SizeOptions, ThemeOptions, VideoOptions, YoutubeTokenMeta };
517
+ export { AcFunTokenMeta, ArtPlayerTokenMeta, BilibiliTokenMeta, CanIUseMode, CanIUseOptions, CanIUseTokenMeta, CodeSandboxTokenMeta, CodeTabsOptions, CodepenTokenMeta, DemoContainerRender, DemoFile, DemoMeta, FileTreeIconMode, FileTreeOptions, FontAwesomeAssetBuiltIn, FontAwesomePrefix, FontAwesomeProvider, IconAssetLink, IconFontProvider, IconOptions, IconProviderBase, IconifyPrefix, IconifyProvider, JSFiddleTokenMeta, LiteralUnion, MarkdownDemoEnv, MarkdownPowerPluginOptions, NpmToOptions, NpmToPackageManager, PDFEmbedType, PDFOptions, PDFTokenMeta, PlotOptions, ReplEditorData, ReplOptions, ReplitTokenMeta, SizeOptions, ThemeOptions, VideoOptions, YoutubeTokenMeta };
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.154",
4
+ "version": "1.0.0-rc.155",
5
5
  "description": "The Plugin for VuePress 2 - markdown power",
6
6
  "author": "pengzhanbo <volodymyr@foxmail.com>",
7
7
  "license": "MIT",
@@ -93,7 +93,7 @@
93
93
  "lru-cache": "^11.1.0",
94
94
  "markdown-it-container": "^4.0.0",
95
95
  "nanoid": "^5.1.5",
96
- "shiki": "^3.6.0",
96
+ "shiki": "^3.7.0",
97
97
  "tinyglobby": "0.2.13",
98
98
  "tm-grammars": "^1.23.26",
99
99
  "tm-themes": "^1.10.6",
@@ -1,45 +0,0 @@
1
- <script setup lang="ts">
2
- import { toRefs } from 'vue'
3
- import { useSize } from '../composables/size.js'
4
-
5
- const props = defineProps<{
6
- src: string
7
- title: string
8
- width?: string
9
- height?: string
10
- ratio?: string
11
- }>()
12
-
13
- const IFRAME_ALLOW = 'accelerometer; autoplay; clipboard-write; encrypted-media; fullscreen; gyroscope; picture-in-picture'
14
-
15
- const options = toRefs(props)
16
-
17
- const { el, width, height, resize } = useSize(options)
18
-
19
- function onLoad() {
20
- resize()
21
- }
22
- </script>
23
-
24
- <template>
25
- <ClientOnly>
26
- <iframe
27
- ref="el"
28
- class="video_bilibili_iframe"
29
- :src="src"
30
- :title="title || 'Bilibili'"
31
- :style="{ width, height }"
32
- :allow="IFRAME_ALLOW"
33
- @load="onLoad"
34
- />
35
- </ClientOnly>
36
- </template>
37
-
38
- <style>
39
- .video_bilibili_iframe {
40
- width: 100%;
41
- margin: 16px auto;
42
- border: none;
43
- border-radius: 5px;
44
- }
45
- </style>