@slidev/cli 0.48.0-beta.11 → 0.48.0-beta.12

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.
@@ -2,7 +2,7 @@ import {
2
2
  ViteSlidevPlugin,
3
3
  getIndexHtml,
4
4
  mergeViteConfigs
5
- } from "./chunk-7HWAUX7C.mjs";
5
+ } from "./chunk-E34YDWCY.mjs";
6
6
  import "./chunk-O6TYYGU6.mjs";
7
7
  import {
8
8
  findPkgRoot
@@ -2496,7 +2496,7 @@ var require_semver2 = __commonJS({
2496
2496
  });
2497
2497
 
2498
2498
  // package.json
2499
- var version = "0.48.0-beta.11";
2499
+ var version = "0.48.0-beta.12";
2500
2500
 
2501
2501
  // node/common.ts
2502
2502
  import { existsSync, promises as fs } from "node:fs";
@@ -2757,10 +2757,20 @@ md.use(mila, {
2757
2757
  rel: "noopener"
2758
2758
  }
2759
2759
  });
2760
- function renderNoteHTML(data) {
2760
+ function renderNote(text = "") {
2761
+ let clickCount = 0;
2762
+ const html = md.render(
2763
+ text.replace(/\[click(?::(\d+))?\]/gi, (_, count = 1) => {
2764
+ clickCount += Number(count);
2765
+ return `<span class="slidev-note-click-mark" data-clicks="${clickCount}"></span>`;
2766
+ })
2767
+ );
2768
+ return html;
2769
+ }
2770
+ function withRenderedNote(data) {
2761
2771
  return {
2762
2772
  ...data,
2763
- noteHTML: md.render(data?.note || "")
2773
+ noteHTML: renderNote(data?.note)
2764
2774
  };
2765
2775
  }
2766
2776
  function createSlidesLoader({ data, clientRoot, roots, remote, mode }, pluginOptions, serverOptions) {
@@ -2782,7 +2792,7 @@ function createSlidesLoader({ data, clientRoot, roots, remote, mode }, pluginOpt
2782
2792
  const [, no, type] = match;
2783
2793
  const idx = Number.parseInt(no);
2784
2794
  if (type === "json" && req.method === "GET") {
2785
- res.write(JSON.stringify(renderNoteHTML(data.slides[idx])));
2795
+ res.write(JSON.stringify(withRenderedNote(data.slides[idx])));
2786
2796
  return res.end();
2787
2797
  }
2788
2798
  if (type === "json" && req.method === "POST") {
@@ -2794,7 +2804,7 @@ function createSlidesLoader({ data, clientRoot, roots, remote, mode }, pluginOpt
2794
2804
  parser.prettifySlide(slide.source);
2795
2805
  await parser.save(data.markdownFiles[slide.source.filepath]);
2796
2806
  res.statusCode = 200;
2797
- res.write(JSON.stringify(renderNoteHTML(slide)));
2807
+ res.write(JSON.stringify(withRenderedNote(slide)));
2798
2808
  return res.end();
2799
2809
  }
2800
2810
  next();
@@ -2842,7 +2852,7 @@ function createSlidesLoader({ data, clientRoot, roots, remote, mode }, pluginOpt
2842
2852
  data: {
2843
2853
  id: i,
2844
2854
  note: b.note || "",
2845
- noteHTML: md.render(b.note || "")
2855
+ noteHTML: renderNote(b.note || "")
2846
2856
  }
2847
2857
  });
2848
2858
  }
@@ -2853,7 +2863,7 @@ function createSlidesLoader({ data, clientRoot, roots, remote, mode }, pluginOpt
2853
2863
  event: "slidev-update",
2854
2864
  data: {
2855
2865
  id: i,
2856
- data: renderNoteHTML(newData.slides[i])
2866
+ data: withRenderedNote(newData.slides[i])
2857
2867
  }
2858
2868
  });
2859
2869
  hmrPages.add(i);
@@ -2921,7 +2931,7 @@ ${title}
2921
2931
  };
2922
2932
  } else if (type === "frontmatter") {
2923
2933
  const slideBase = {
2924
- ...renderNoteHTML(slide),
2934
+ ...withRenderedNote(slide),
2925
2935
  frontmatter: void 0,
2926
2936
  source: void 0,
2927
2937
  // remove raw content in build, optimize the bundle size
@@ -4,7 +4,7 @@ import {
4
4
  mergeViteConfigs,
5
5
  require_semver,
6
6
  version
7
- } from "./chunk-7HWAUX7C.mjs";
7
+ } from "./chunk-E34YDWCY.mjs";
8
8
  import {
9
9
  createResolver,
10
10
  getRoots,
package/dist/cli.mjs CHANGED
@@ -5,10 +5,10 @@ import {
5
5
  resolveAddons,
6
6
  resolveOptions,
7
7
  resolveTheme
8
- } from "./chunk-DFSBG7Q2.mjs";
8
+ } from "./chunk-YLK3KG3T.mjs";
9
9
  import {
10
10
  version
11
- } from "./chunk-7HWAUX7C.mjs";
11
+ } from "./chunk-E34YDWCY.mjs";
12
12
  import {
13
13
  loadSetups
14
14
  } from "./chunk-O6TYYGU6.mjs";
@@ -277,7 +277,7 @@ cli.command(
277
277
  }).strict().help(),
278
278
  async (args) => {
279
279
  const { entry, theme, watch, base, download, out, inspect } = args;
280
- const { build } = await import("./build-DTVJA6KF.mjs");
280
+ const { build } = await import("./build-CLZFYNH7.mjs");
281
281
  for (const entryFile of entry) {
282
282
  const options = await resolveOptions({ entry: entryFile, theme, inspect }, "build");
283
283
  if (download && !options.data.config.download)
package/dist/index.mjs CHANGED
@@ -2,10 +2,10 @@ import {
2
2
  createServer,
3
3
  parser,
4
4
  resolveOptions
5
- } from "./chunk-DFSBG7Q2.mjs";
5
+ } from "./chunk-YLK3KG3T.mjs";
6
6
  import {
7
7
  ViteSlidevPlugin
8
- } from "./chunk-7HWAUX7C.mjs";
8
+ } from "./chunk-E34YDWCY.mjs";
9
9
  import "./chunk-O6TYYGU6.mjs";
10
10
  import "./chunk-7HOZGSL4.mjs";
11
11
  import "./chunk-BXO7ZPPU.mjs";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@slidev/cli",
3
- "version": "0.48.0-beta.11",
3
+ "version": "0.48.0-beta.12",
4
4
  "description": "Presentation slides for developers",
5
5
  "author": "antfu <anthonyfu117@hotmail.com>",
6
6
  "license": "MIT",
@@ -104,9 +104,9 @@
104
104
  "vitefu": "^0.2.5",
105
105
  "vue": "^3.4.19",
106
106
  "yargs": "^17.7.2",
107
- "@slidev/parser": "0.48.0-beta.11",
108
- "@slidev/client": "0.48.0-beta.11",
109
- "@slidev/types": "0.48.0-beta.11"
107
+ "@slidev/parser": "0.48.0-beta.12",
108
+ "@slidev/types": "0.48.0-beta.12",
109
+ "@slidev/client": "0.48.0-beta.12"
110
110
  },
111
111
  "devDependencies": {
112
112
  "@hedgedoc/markdown-it-plugins": "^2.1.4",