@classic-homes/slides 0.5.10 → 0.5.11

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.
@@ -600,7 +600,7 @@ function inline(text) {
600
600
  return `\uE000${codes.length - 1}\uE000`;
601
601
  });
602
602
  const links = [];
603
- s = s.replace(/\[([^\]]+)\]\(([^)\s]+)\)/g, (match, label, url) => {
603
+ s = s.replace(/\[([^[\]]+)\]\(([^)\s[]+)\)/g, (match, label, url) => {
604
604
  if (!isSafeLinkUrl(url)) return label;
605
605
  links.push(`<a href="${escapeAttr(url)}">${formatEmphasis(escapeHtml(label))}</a>`);
606
606
  return `\uE001${links.length - 1}\uE001`;
@@ -615,7 +615,7 @@ function inline(text) {
615
615
  return s;
616
616
  }
617
617
  function formatEmphasis(escaped) {
618
- return escaped.replace(/\*\*(.+?)\*\*/g, "<b>$1</b>").replace(/(^|[^*])\*(?!\s)(.+?)(?<!\s)\*(?!\*)/g, '$1<em class="hl">$2</em>');
618
+ return escaped.replace(/\*\*(.+?)\*\*/g, "<b>$1</b>").replace(/(^|[^*])\*(?!\s)([^*\n]+?)(?<!\s)\*(?!\*)/g, '$1<em class="hl">$2</em>');
619
619
  }
620
620
  function prose(text) {
621
621
  if (!text) return "";
@@ -629,7 +629,7 @@ function prose(text) {
629
629
  }
630
630
  function plain(text) {
631
631
  if (!text) return "";
632
- return text.replace(/`([^`]+)`/g, "$1").replace(/\[([^\]]+)\]\([^)]+\)/g, "$1").replace(/\*\*(.+?)\*\*/g, "$1").replace(/\*(.+?)\*/g, "$1");
632
+ return text.replace(/`([^`]+)`/g, "$1").replace(/\[([^[\]]+)\]\([^)[]+\)/g, "$1").replace(/\*\*(.+?)\*\*/g, "$1").replace(/\*(.+?)\*/g, "$1");
633
633
  }
634
634
 
635
635
  // src/video.ts
@@ -2091,7 +2091,9 @@ var LAYOUT_CATEGORIES = {
2091
2091
 
2092
2092
  // src/edit.ts
2093
2093
  function findSlide(deck, ref) {
2094
- const index = typeof ref === "number" || /^\d+$/.test(ref) ? Number(ref) - 1 : deck.slides.findIndex((s) => s.id === ref);
2094
+ let index = typeof ref === "string" ? deck.slides.findIndex((s) => s.id === ref) : -1;
2095
+ if (index < 0 && (typeof ref === "number" ? Number.isInteger(ref) : /^\d+$/.test(ref)))
2096
+ index = Number(ref) - 1;
2095
2097
  if (index < 0 || index >= deck.slides.length) {
2096
2098
  throw new Error(
2097
2099
  `No slide "${ref}". The deck has ${deck.slides.length} slides; use a 1-based number or a slide id.`
@@ -3715,7 +3717,8 @@ function fromZod(issue) {
3715
3717
  if (issue.code === "invalid_union_discriminator") {
3716
3718
  message = `Unknown layout. Use one of: ${issue.options.join(", ")}.`;
3717
3719
  } else if (issue.code === "unrecognized_keys") {
3718
- message = `Unknown field(s) ${issue.keys.map((k) => `"${k}"`).join(", ")} for this layout.`;
3720
+ const onSlide = issue.path.length === 2 && issue.path[0] === "slides" && typeof issue.path[1] === "number";
3721
+ message = `Unknown field(s) ${issue.keys.map((k) => `"${k}"`).join(", ")}${onSlide ? " for this layout" : ""}.`;
3719
3722
  }
3720
3723
  return { level: "error", path: issue.path, message };
3721
3724
  }
@@ -3822,6 +3825,7 @@ function byPath(issues) {
3822
3825
  }
3823
3826
  function formatPath(path) {
3824
3827
  if (!path.length) return "deck";
3828
+ if (path.length === 1 && path[0] === "slides") return "slides";
3825
3829
  return path.map(
3826
3830
  (p, i) => typeof p === "number" ? path[i - 1] === "slides" ? `slide ${p + 1}` : String(p + 1) : p
3827
3831
  ).filter((p) => p !== "slides").join(" \u203A ");
@@ -3984,4 +3988,4 @@ export {
3984
3988
  inlineDeckImages,
3985
3989
  externalizeDeckImages
3986
3990
  };
3987
- //# sourceMappingURL=chunk-LQPZWWGZ.js.map
3991
+ //# sourceMappingURL=chunk-25NZMEQG.js.map