vuepress-plugin-md-power 1.0.0-rc.124 → 1.0.0-rc.125

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.
Files changed (2) hide show
  1. package/lib/node/index.js +31 -31
  2. package/package.json +3 -3
package/lib/node/index.js CHANGED
@@ -1856,13 +1856,15 @@ var audioReader = (state, silent) => {
1856
1856
  if (pos >= max || state.src.charCodeAt(pos) !== 41) {
1857
1857
  return false;
1858
1858
  }
1859
+ } else {
1860
+ return false;
1859
1861
  }
1860
1862
  if (!silent) {
1861
1863
  state.pos = labelStart;
1862
1864
  state.posMax = labelEnd;
1863
1865
  const info = state.src.slice(labelStart, labelEnd).trim();
1864
1866
  const { attrs: attrs2 } = resolveAttrs(info);
1865
- const tokenOpen = state.push("audio_reader_open", "audioReader", 1);
1867
+ const tokenOpen = state.push("audio_reader_open", "AudioReader", 1);
1866
1868
  tokenOpen.info = info;
1867
1869
  tokenOpen.attrs = [["src", href]];
1868
1870
  if (attrs2.startTime)
@@ -1875,7 +1877,7 @@ var audioReader = (state, silent) => {
1875
1877
  tokenOpen.attrs.push([":volume", attrs2.volume]);
1876
1878
  if (attrs2.title)
1877
1879
  state.push("text", "", 0).content = attrs2.title;
1878
- state.push("audio_reader_close", "audioReader", -1);
1880
+ state.push("audio_reader_close", "AudioReader", -1);
1879
1881
  }
1880
1882
  state.pos = pos + 1;
1881
1883
  state.posMax = max;
@@ -2401,14 +2403,16 @@ import { tasklist } from "@mdit/plugin-tasklist";
2401
2403
  import { isPlainObject as isPlainObject3 } from "@vuepress/helper";
2402
2404
 
2403
2405
  // src/node/inline/icons.ts
2404
- var [openTag, endTag] = [":[", "]:"];
2405
2406
  var iconsPlugin = (md, options = {}) => md.inline.ruler.before("emphasis", "iconify", createTokenizer(options));
2406
2407
  function createTokenizer(options) {
2407
2408
  return (state, silent) => {
2408
2409
  let found = false;
2409
2410
  const max = state.posMax;
2410
2411
  const start = state.pos;
2411
- if (state.src.slice(start, start + 2) !== openTag)
2412
+ if (state.src.charCodeAt(start) !== 58 || state.src.charCodeAt(start + 1) !== 91) {
2413
+ return false;
2414
+ }
2415
+ if (state.src.charCodeAt(start + 2) === 32)
2412
2416
  return false;
2413
2417
  if (silent)
2414
2418
  return false;
@@ -2416,34 +2420,30 @@ function createTokenizer(options) {
2416
2420
  return false;
2417
2421
  state.pos = start + 2;
2418
2422
  while (state.pos < max) {
2419
- if (state.src.slice(state.pos, state.pos + 2) === endTag) {
2423
+ if (state.src.charCodeAt(state.pos) === 93 && state.src.charCodeAt(state.pos + 1) === 58) {
2420
2424
  found = true;
2421
2425
  break;
2422
2426
  }
2423
2427
  state.md.inline.skipToken(state);
2424
2428
  }
2425
- if (!found || start + 2 === state.pos) {
2429
+ if (!found || start + 2 === state.pos || state.src.charCodeAt(state.pos - 1) === 32) {
2426
2430
  state.pos = start;
2427
2431
  return false;
2428
2432
  }
2429
2433
  const content = state.src.slice(start + 2, state.pos);
2430
- if (/^\s|\s$/.test(content)) {
2431
- state.pos = start;
2432
- return false;
2433
- }
2434
2434
  state.posMax = state.pos;
2435
2435
  state.pos = start + 2;
2436
- const [name, opt = ""] = content.split(/\s+/);
2437
- const [size, color = options.color] = opt.split("/");
2438
- const icon = state.push("vp_iconify_open", "VPIcon", 1);
2439
- icon.markup = openTag;
2440
- icon.attrSet("name", name);
2436
+ const [name, opt = ""] = content.split(" ");
2437
+ const [size, color = options.color] = opt.trim().split("/");
2438
+ const icon = state.push("vp_icon_open", "VPIcon", 1);
2439
+ icon.markup = ":[";
2440
+ icon.attrs = [["name", name]];
2441
2441
  if (size || options.size)
2442
- icon.attrSet("size", String(size || options.size));
2442
+ icon.attrs.push(["size", String(size || options.size)]);
2443
2443
  if (color)
2444
- icon.attrSet("color", color);
2445
- const close = state.push("vp_iconify_close", "VPIcon", -1);
2446
- close.markup = endTag;
2444
+ icon.attrs.push(["color", color]);
2445
+ const close = state.push("vp_icon_close", "VPIcon", -1);
2446
+ close.markup = "]:";
2447
2447
  state.pos = state.posMax + 2;
2448
2448
  state.posMax = max;
2449
2449
  return true;
@@ -2451,14 +2451,17 @@ function createTokenizer(options) {
2451
2451
  }
2452
2452
 
2453
2453
  // src/node/inline/plot.ts
2454
- var [openTag2, endTag2] = ["!!", "!!"];
2455
2454
  var plotPlugin = (md) => md.inline.ruler.before("emphasis", "plot", createTokenizer2());
2456
2455
  function createTokenizer2() {
2457
2456
  return (state, silent) => {
2458
2457
  let found = false;
2459
2458
  const max = state.posMax;
2460
2459
  const start = state.pos;
2461
- if (state.src.slice(start, start + 2) !== openTag2)
2460
+ if (state.src.charCodeAt(start) !== 33 || state.src.charCodeAt(start + 1) !== 33) {
2461
+ return false;
2462
+ }
2463
+ const next = state.src.charCodeAt(start + 2);
2464
+ if (next === 32 || next === 33)
2462
2465
  return false;
2463
2466
  if (silent)
2464
2467
  return false;
@@ -2466,29 +2469,25 @@ function createTokenizer2() {
2466
2469
  return false;
2467
2470
  state.pos = start + 2;
2468
2471
  while (state.pos < max) {
2469
- if (state.src.slice(state.pos - 1, state.pos + 1) === endTag2) {
2472
+ if (state.src.charCodeAt(state.pos) === 33 && state.src.charCodeAt(state.pos + 1) === 33) {
2470
2473
  found = true;
2471
2474
  break;
2472
2475
  }
2473
2476
  state.md.inline.skipToken(state);
2474
2477
  }
2475
- if (!found || start + 2 === state.pos) {
2478
+ if (!found || start + 2 === state.pos || state.src.charCodeAt(state.pos - 1) === 32) {
2476
2479
  state.pos = start;
2477
2480
  return false;
2478
2481
  }
2479
- const content = state.src.slice(start + 2, state.pos - 1);
2480
- if (/^\s|\s$/.test(content)) {
2481
- state.pos = start;
2482
- return false;
2483
- }
2484
- state.posMax = state.pos - 1;
2482
+ const content = state.src.slice(start + 2, state.pos);
2483
+ state.posMax = state.pos;
2485
2484
  state.pos = start + 2;
2486
2485
  const open = state.push("plot_open", "Plot", 1);
2487
- open.markup = openTag2;
2486
+ open.markup = "!!";
2488
2487
  const text = state.push("text", "", 0);
2489
2488
  text.content = content;
2490
2489
  const close = state.push("plot_close", "Plot", -1);
2491
- close.markup = endTag2;
2490
+ close.markup = "!!";
2492
2491
  state.pos = state.posMax + 2;
2493
2492
  state.posMax = max;
2494
2493
  return true;
@@ -2626,5 +2625,6 @@ export {
2626
2625
  markdownPowerPlugin,
2627
2626
  resolveImageSize
2628
2627
  };
2628
+ /* istanbul ignore else -- @preserve */
2629
2629
  /* istanbul ignore if -- @preserve */
2630
2630
  /* istanbul ignore next -- @preserve */
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.124",
4
+ "version": "1.0.0-rc.125",
5
5
  "description": "The Plugin for VuePress 2 - markdown power",
6
6
  "author": "pengzhanbo <volodymyr@foxmail.com>",
7
7
  "license": "MIT",
@@ -70,8 +70,8 @@
70
70
  "markdown-it-container": "^4.0.0",
71
71
  "nanoid": "^5.0.9",
72
72
  "shiki": "^1.24.4",
73
- "tm-grammars": "^1.21.9",
74
- "tm-themes": "^1.9.5",
73
+ "tm-grammars": "^1.21.11",
74
+ "tm-themes": "^1.9.6",
75
75
  "vue": "^3.5.13"
76
76
  },
77
77
  "devDependencies": {