@canofold/markdown 0.3.1 → 0.3.2

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 (33) hide show
  1. package/README.md +2 -0
  2. package/README.zh-CN.md +2 -0
  3. package/dist/ImageGallery-Bcpjlfh9.js +569 -0
  4. package/dist/Markdown-607_slPB.js +117 -0
  5. package/dist/assets-CqlggKr8.js +77 -0
  6. package/dist/client/bundler.js +308 -0
  7. package/dist/client/chunks/{client-CTpZrdpv.js → client-CHUUETWE.js} +3 -3
  8. package/dist/client/chunks/{gallery-BTg1qJjd.js → gallery-Cr0TgC1h.js} +2 -2
  9. package/dist/client/chunks/{image-BsfZtDsx.js → image-6_o7fPkU.js} +3 -3
  10. package/dist/client/chunks/provider-k1N-5njv.js +1037 -0
  11. package/dist/client/chunks/react-runtime-DRPMrVPX.js +12062 -0
  12. package/dist/client/chunks/{serialized-Ck9NBdg7.js → serialized-Chn9ydGA.js} +334 -295
  13. package/dist/client/chunks/{table-jaJMPch3.js → table-D99-Zhc8.js} +3 -3
  14. package/dist/client/index.js +1 -1
  15. package/dist/componentMap-CKSUGzQH.js +1483 -0
  16. package/dist/copyText-C0ZgrMnH.js +18 -0
  17. package/dist/{directiveValidation-BdVbgcY_.js → directiveValidation-B7LY-R5p.js} +187 -248
  18. package/dist/fileKinds-BPzIxbaS.js +170 -0
  19. package/dist/gallery-BqQ-i0TC.js +42 -0
  20. package/dist/image-CiPni6Az.js +38 -0
  21. package/dist/index.js +2 -2
  22. package/dist/plugins-CXYBB-oH.js +130 -0
  23. package/dist/{prepareMarkdown-DPMq7203.js → prepareMarkdown-CS6sALIb.js} +13 -11
  24. package/dist/provider-BJDHf4Z_.js +8 -0
  25. package/dist/serialized-DFiNQYA5.js +39 -0
  26. package/dist/server/analyze.js +11 -11
  27. package/dist/server.js +30 -28
  28. package/dist/table-DQSeLjVL.js +32 -0
  29. package/package.json +14 -9
  30. package/dist/Markdown-CPG2lcO7.js +0 -2127
  31. package/dist/client/chunks/provider-DNSHvvN7.js +0 -841
  32. package/dist/client/chunks/react-runtime-Dzgdzn6D.js +0 -10571
  33. package/dist/plugins-StkCS2su.js +0 -298
@@ -0,0 +1,170 @@
1
+ const r = {
2
+ "package.json": "package",
3
+ "package-lock.json": "package",
4
+ "pnpm-lock.yaml": "package",
5
+ "yarn.lock": "package",
6
+ "bun.lock": "package",
7
+ "bun.lockb": "package",
8
+ "deno.json": "package",
9
+ "deno.jsonc": "package",
10
+ "pnpm-workspace.yaml": "package",
11
+ ".gitignore": "config",
12
+ ".editorconfig": "config",
13
+ ".npmrc": "config",
14
+ ".nvmrc": "config",
15
+ ".prettierrc": "config",
16
+ "biome.json": "config",
17
+ dockerfile: "container",
18
+ containerfile: "container",
19
+ "tsconfig.json": "config",
20
+ "jsconfig.json": "config",
21
+ "turbo.json": "config",
22
+ "vite.config.ts": "config",
23
+ "vite.config.js": "config"
24
+ }, i = {
25
+ ts: "typescript",
26
+ tsx: "typescript",
27
+ mts: "typescript",
28
+ cts: "typescript",
29
+ js: "javascript",
30
+ jsx: "javascript",
31
+ mjs: "javascript",
32
+ cjs: "javascript",
33
+ md: "markdown",
34
+ mdx: "markdown",
35
+ css: "style",
36
+ conf: "config",
37
+ scss: "style",
38
+ sass: "style",
39
+ less: "style",
40
+ json: "data",
41
+ jsonc: "data",
42
+ yaml: "data",
43
+ yml: "data",
44
+ toml: "data",
45
+ sql: "database",
46
+ diff: "diff",
47
+ patch: "diff",
48
+ sh: "shell",
49
+ bash: "shell",
50
+ zsh: "shell",
51
+ fish: "shell",
52
+ vue: "component",
53
+ svelte: "component",
54
+ astro: "component",
55
+ py: "source",
56
+ go: "source",
57
+ rs: "source"
58
+ }, l = {
59
+ typescript: "typescript",
60
+ ts: "typescript",
61
+ tsx: "typescript",
62
+ javascript: "javascript",
63
+ js: "javascript",
64
+ jsx: "javascript",
65
+ markdown: "markdown",
66
+ md: "markdown",
67
+ mdx: "markdown",
68
+ css: "style",
69
+ scss: "style",
70
+ sass: "style",
71
+ less: "style",
72
+ json: "data",
73
+ jsonc: "data",
74
+ yaml: "data",
75
+ yml: "data",
76
+ toml: "data",
77
+ sql: "database",
78
+ diff: "diff",
79
+ docker: "container",
80
+ dockerfile: "container",
81
+ nginx: "config",
82
+ shell: "shell",
83
+ sh: "shell",
84
+ bash: "shell",
85
+ zsh: "shell",
86
+ terminal: "shell",
87
+ vue: "component",
88
+ svelte: "component",
89
+ astro: "component",
90
+ python: "source",
91
+ py: "source",
92
+ go: "source",
93
+ rust: "source",
94
+ rs: "source"
95
+ };
96
+ function p(o, t = "") {
97
+ const e = o.split(/[\\/]/).pop()?.toLowerCase() || "", s = r[e];
98
+ if (s) return s;
99
+ if (/^\.env(?:\..+)?$/.test(e)) return "environment";
100
+ if (/(^|\.)config\.[^.]+$/.test(e) || /^\.[a-z0-9-]+rc(?:\.[^.]+)?$/.test(e))
101
+ return "config";
102
+ const n = e.includes(".") && e.split(".").pop() || "";
103
+ return i[n] || l[t.toLowerCase()] || "file";
104
+ }
105
+ const a = {
106
+ astro: "astro",
107
+ bash: "console",
108
+ css: "css",
109
+ diff: "diff",
110
+ docker: "docker",
111
+ dockerfile: "docker",
112
+ go: "go",
113
+ javascript: "javascript",
114
+ js: "javascript",
115
+ jsx: "javascript",
116
+ json: "json",
117
+ jsonc: "json",
118
+ markdown: "markdown",
119
+ md: "markdown",
120
+ mdx: "markdown",
121
+ python: "python",
122
+ py: "python",
123
+ rust: "rust",
124
+ rs: "rust",
125
+ sass: "sass",
126
+ scss: "sass",
127
+ shell: "console",
128
+ sh: "console",
129
+ sql: "database",
130
+ svelte: "svelte",
131
+ terminal: "console",
132
+ typescript: "typescript",
133
+ ts: "typescript",
134
+ tsx: "typescript",
135
+ vue: "vue",
136
+ yaml: "yaml",
137
+ yml: "yaml",
138
+ zsh: "console"
139
+ };
140
+ function f(o, t = "") {
141
+ const e = o.replace(/\\/g, "/").toLowerCase(), s = e.split("/").pop() || "";
142
+ if (/^canofold\.config\.(?:[cm]?[jt]s)$/.test(s)) return "canofold";
143
+ if (/^(?:.*\/)?\.github\/workflows\/[^/]+\.ya?ml$/.test(e)) return "github-actions";
144
+ if (["npm", "pnpm", "yarn", "bun", "deno"].includes(s))
145
+ return s;
146
+ if (s === "package.json") return "nodejs";
147
+ if (s.startsWith("pnpm-") || s === "pnpm-lock.yaml") return "pnpm";
148
+ if (s === "package-lock.json" || s === ".npmrc") return "npm";
149
+ if (s === "yarn.lock") return "yarn";
150
+ if (s === "bun.lock" || s === "bun.lockb") return "bun";
151
+ if (s === "deno.json" || s === "deno.jsonc") return "deno";
152
+ if (s === "dockerfile" || s === "containerfile") return "docker";
153
+ if (s === ".gitignore" || s === ".gitattributes" || s === ".gitmodules")
154
+ return "git";
155
+ if (/^\.env(?:\.|$)/.test(s)) return "environment";
156
+ if (s === "tsconfig.json" || s === "jsconfig.json") return "typescript";
157
+ if (/\.(?:jsx|tsx)$/.test(s)) return "react";
158
+ const n = p(s, t);
159
+ if (n === "config") return "config";
160
+ if (n === "database") return "database";
161
+ if (n === "diff") return "diff";
162
+ if (n === "shell") return "console";
163
+ if (n === "container") return "docker";
164
+ const c = s.includes(".") && s.split(".").pop() || "";
165
+ return a[c] || a[t.toLowerCase()] || "document";
166
+ }
167
+ export {
168
+ f as a,
169
+ p as m
170
+ };
@@ -0,0 +1,42 @@
1
+ import { jsx as r } from "react/jsx-runtime";
2
+ import { hydrateRoot as s } from "react-dom/client";
3
+ import { I as l } from "./ImageGallery-Bcpjlfh9.js";
4
+ import { w as i } from "./provider-BJDHf4Z_.js";
5
+ function n(e) {
6
+ try {
7
+ const a = JSON.parse(e.dataset.cfGalleryItems ?? "[]");
8
+ return Array.isArray(a) ? a.filter(
9
+ (t) => !!(t && typeof t == "object" && typeof t.src == "string" && typeof t.alt == "string")
10
+ ) : [];
11
+ } catch {
12
+ return [];
13
+ }
14
+ }
15
+ function u(e, a) {
16
+ return s(
17
+ e,
18
+ i(
19
+ /* @__PURE__ */ r(
20
+ l,
21
+ {
22
+ items: n(e),
23
+ className: e.className || void 0,
24
+ role: e.getAttribute("role") === "region" ? "region" : "group",
25
+ labels: {
26
+ gallery: e.dataset.cfGalleryLabel,
27
+ close: e.dataset.cfCloseLabel,
28
+ previous: e.dataset.cfPreviousLabel,
29
+ next: e.dataset.cfNextLabel,
30
+ thumbnails: e.dataset.cfThumbnailsLabel,
31
+ image: e.dataset.cfImageLabel
32
+ },
33
+ inner: !0
34
+ }
35
+ ),
36
+ a
37
+ )
38
+ );
39
+ }
40
+ export {
41
+ u as hydrate
42
+ };
@@ -0,0 +1,38 @@
1
+ import { jsx as r } from "react/jsx-runtime";
2
+ import { hydrateRoot as d } from "react-dom/client";
3
+ import { M as o } from "./componentMap-CKSUGzQH.js";
4
+ import { r as s } from "./serialized-DFiNQYA5.js";
5
+ import { w as l } from "./provider-BJDHf4Z_.js";
6
+ function u(i, a) {
7
+ const t = i.querySelector("img");
8
+ if (!t) return;
9
+ const e = s(i.dataset.cfIslandData, a);
10
+ return d(
11
+ i,
12
+ l(
13
+ /* @__PURE__ */ r(
14
+ o,
15
+ {
16
+ src: e ? void 0 : t.getAttribute("src") ?? "",
17
+ alt: e ? void 0 : t.getAttribute("alt") ?? "",
18
+ title: e ? void 0 : t.getAttribute("title") ?? void 0,
19
+ width: e ? void 0 : t.getAttribute("width") ?? void 0,
20
+ height: e ? void 0 : t.getAttribute("height") ?? void 0,
21
+ loading: e || !t.hasAttribute("loading") ? void 0 : t.getAttribute("loading") === "eager" ? "eager" : "lazy",
22
+ srcSet: e ? void 0 : t.getAttribute("srcset") ?? void 0,
23
+ sizes: e ? void 0 : t.getAttribute("sizes") ?? void 0,
24
+ caption: e ? void 0 : i.querySelector("figcaption")?.textContent ?? void 0,
25
+ className: i.className || void 0,
26
+ zoomLabel: i.dataset.cfZoomLabel,
27
+ closeLabel: i.dataset.cfCloseLabel,
28
+ inner: !0,
29
+ children: e
30
+ }
31
+ ),
32
+ a
33
+ )
34
+ );
35
+ }
36
+ export {
37
+ u as hydrate
38
+ };
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { M as a } from "./Markdown-CPG2lcO7.js";
2
- import { d as e } from "./plugins-StkCS2su.js";
1
+ import { M as a } from "./Markdown-607_slPB.js";
2
+ import { d as e } from "./plugins-CXYBB-oH.js";
3
3
  export {
4
4
  a as Markdown,
5
5
  e as defineMarkdownPlugin
@@ -0,0 +1,130 @@
1
+ function c(e, r) {
2
+ if (e === null || typeof e == "string" || typeof e == "boolean") return JSON.stringify(e);
3
+ if (typeof e == "number") {
4
+ if (!Number.isFinite(e)) throw new TypeError("Numbers must be finite");
5
+ return String(e);
6
+ }
7
+ if (typeof e != "object") throw new TypeError("Value is not JSON serializable");
8
+ if (r.has(e)) throw new TypeError("Circular JSON value");
9
+ const o = Object.getPrototypeOf(e);
10
+ if (!Array.isArray(e) && o !== Object.prototype && o !== null)
11
+ throw new TypeError("Only plain objects are JSON serializable");
12
+ r.add(e);
13
+ try {
14
+ if (Array.isArray(e)) {
15
+ if (Object.keys(e).length !== e.length) throw new TypeError("Sparse arrays are not supported");
16
+ return `[${e.map((t) => c(t, r)).join(",")}]`;
17
+ }
18
+ return `{${Object.keys(e).sort().map((t) => `${JSON.stringify(t)}:${c(e[t], r)}`).join(",")}}`;
19
+ } finally {
20
+ r.delete(e);
21
+ }
22
+ }
23
+ function w(e) {
24
+ try {
25
+ return c(e, /* @__PURE__ */ new WeakSet());
26
+ } catch {
27
+ return;
28
+ }
29
+ }
30
+ const m = /^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/, d = /^[A-Za-z_$][A-Za-z0-9_$]*$/;
31
+ function u(e) {
32
+ if (typeof e != "string" || !m.test(e))
33
+ throw new Error(
34
+ `Markdown plugin names must be lowercase kebab-case slugs (e.g. "external-links"), got ${JSON.stringify(e)}`
35
+ );
36
+ }
37
+ function g(e) {
38
+ if (e.cacheKey !== void 0 && w(e.cacheKey) === void 0)
39
+ throw new Error(`Markdown plugin "${e.name}" cacheKey must be JSON-serializable`);
40
+ }
41
+ function l(e) {
42
+ const r = e.browserCompiler;
43
+ if (r) {
44
+ if (typeof r.module != "string" || r.module.trim() === "")
45
+ throw new Error(`Markdown plugin "${e.name}" browserCompiler.module must be a non-empty string`);
46
+ if (typeof r.exportName != "string" || !d.test(r.exportName))
47
+ throw new Error(
48
+ `Markdown plugin "${e.name}" browserCompiler.exportName must be a named JavaScript export`
49
+ );
50
+ if (r.options !== void 0 && w(r.options) === void 0)
51
+ throw new Error(`Markdown plugin "${e.name}" browserCompiler.options must be JSON-serializable`);
52
+ }
53
+ }
54
+ function f(e) {
55
+ return (e.directiveNames ?? []).map((r) => {
56
+ const o = r.trim().toLowerCase();
57
+ if (r !== o || !m.test(o))
58
+ throw new Error(
59
+ `Markdown plugin "${e.name}" directive names must be lowercase kebab-case slugs, got ${JSON.stringify(r)}`
60
+ );
61
+ return o;
62
+ });
63
+ }
64
+ function p(e = []) {
65
+ const r = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Map();
66
+ for (const n of e) {
67
+ if (u(n?.name), g(n), l(n), r.has(n.name))
68
+ throw new Error(`Markdown plugins must have unique names, got "${n.name}" twice`);
69
+ r.add(n.name);
70
+ for (const i of n.fenceLanguages ?? []) {
71
+ const a = i.trim().toLowerCase();
72
+ if (!a) continue;
73
+ const s = o.get(a);
74
+ if (s && s !== n.name)
75
+ throw new Error(`Fence language "${a}" is owned by both "${s}" and "${n.name}"`);
76
+ o.set(a, n.name);
77
+ }
78
+ for (const i of f(n)) {
79
+ const a = t.get(i);
80
+ if (a && a !== n.name)
81
+ throw new Error(`Directive "${i}" is owned by both "${a}" and "${n.name}"`);
82
+ t.set(i, n.name);
83
+ }
84
+ }
85
+ return e;
86
+ }
87
+ function y(e = []) {
88
+ return e.map((r) => ({
89
+ name: r.name,
90
+ version: r.version ?? "",
91
+ cacheKey: r.cacheKey ?? null
92
+ }));
93
+ }
94
+ function b(e) {
95
+ return u(e?.name), g(e), l(e), f(e), e;
96
+ }
97
+ function h(e, r) {
98
+ return e.filter((o) => o.appliesTo?.(r) !== !1);
99
+ }
100
+ function N(e) {
101
+ const r = /* @__PURE__ */ new Set();
102
+ for (const o of e)
103
+ for (const t of o.fenceLanguages ?? []) {
104
+ const n = t.trim().toLowerCase();
105
+ n && r.add(n);
106
+ }
107
+ return r;
108
+ }
109
+ function $(e) {
110
+ const r = /* @__PURE__ */ new Set();
111
+ for (const o of e)
112
+ for (const t of o.highlightLanguages ?? []) {
113
+ const n = t.trim().toLowerCase();
114
+ n && r.add(n);
115
+ }
116
+ return [...r];
117
+ }
118
+ function k(e) {
119
+ return new Set(e.flatMap((r) => f(r)));
120
+ }
121
+ export {
122
+ h as a,
123
+ N as b,
124
+ $ as c,
125
+ b as d,
126
+ y as e,
127
+ k as m,
128
+ p as n,
129
+ w as s
130
+ };
@@ -6,9 +6,11 @@ import { remarkDefinitionList as _, defListHastHandlers as R } from "remark-defi
6
6
  import q from "remark-directive";
7
7
  import U from "remark-gfm";
8
8
  import { visit as h, SKIP as b } from "unist-util-visit";
9
- import { r as W, b as J, e as K, f as X, g as Z, h as V, i as Y, j as Q, k as ee, l as te, n as re, a as ae } from "./directiveValidation-BdVbgcY_.js";
10
- import { D as ne, s as oe } from "./Markdown-CPG2lcO7.js";
11
- import { n as ie, m as se, s as F, a as le, b as ce, c as pe } from "./plugins-StkCS2su.js";
9
+ import { r as W, a as J, b as K, d as X, e as Z, f as V, g as Y, h as Q, i as ee, j as te, n as re } from "./directiveValidation-B7LY-R5p.js";
10
+ import { s as ae } from "./componentMap-CKSUGzQH.js";
11
+ import { n as ne, m as oe, s as F, a as ie, b as se, c as le } from "./plugins-CXYBB-oH.js";
12
+ import { c as ce } from "./assets-CqlggKr8.js";
13
+ import { D as pe } from "./ImageGallery-Bcpjlfh9.js";
12
14
  import me from "@shikijs/rehype/core";
13
15
  import { transformerMetaHighlight as fe, transformerNotationHighlight as ue, transformerNotationDiff as de, transformerNotationFocus as ge, transformerNotationWordHighlight as he, transformerNotationErrorLevel as ye } from "@shikijs/transformers";
14
16
  import { createHighlighterCore as Ce } from "shiki/core";
@@ -65,10 +67,10 @@ function Oe(t = {}) {
65
67
  codeBlocks: t.features?.codeBlocks !== !1
66
68
  },
67
69
  labels: {
68
- ...ne,
70
+ ...pe,
69
71
  ...t.labels
70
72
  },
71
- plugins: ie(t.plugins)
73
+ plugins: ne(t.plugins)
72
74
  };
73
75
  }
74
76
  const He = /(?:title|filename|label)\s*=\s*["']([^"']+)["']|\[([^\]]+)\]/i, ze = /(?:^|\s)(wrap|scroll)(?=\s|$)/i;
@@ -452,7 +454,7 @@ const at = (t, e) => (r) => {
452
454
  dataCfSortLabel: e.sortTableColumn,
453
455
  // The raw HAST subtree lets the static React island hydrate the
454
456
  // same table without reparsing Markdown or reading rendered HTML.
455
- dataCfTable: oe(l)
457
+ dataCfTable: ae(l)
456
458
  },
457
459
  children: [l]
458
460
  };
@@ -463,7 +465,7 @@ function nt(t, e, r, a, n) {
463
465
  const { features: o } = r, l = new Set(
464
466
  r.plugins.flatMap((p) => p.fenceLanguages ?? []).map((p) => p.toLowerCase())
465
467
  ), i = [_, U];
466
- i.push(q), i.push([W, se(r.plugins)]), (o.tabs || o.codeGroups) && i.push([J, r]), o.steps && i.push([K, r]), o.callouts && i.push(X), o.documentBlocks && i.push(Z);
468
+ i.push(q), i.push([W, oe(r.plugins)]), (o.tabs || o.codeGroups) && i.push([J, r]), o.steps && i.push([K, r]), o.callouts && i.push(X), o.documentBlocks && i.push(Z);
467
469
  for (const p of r.plugins)
468
470
  p.remarkPlugins && i.push(...p.remarkPlugins);
469
471
  t === "mdx" ? (i.push([Re, e]), o.terminals && i.push([Ze, e, r])) : (o.terminals || a.highlightedCode) && i.push([qe, r]);
@@ -824,8 +826,8 @@ function Pt({
824
826
  return s.use(c.rehypePlugins);
825
827
  }
826
828
  async function At(t, e, r = { warnedLanguages: /* @__PURE__ */ new Set() }) {
827
- const a = ae(), n = Oe(e), o = le(n.plugins, { source: t, mode: "markdown" }), l = ce(o), i = { ...n, plugins: o }, c = St(t, l), s = [
828
- .../* @__PURE__ */ new Set([...c.codeLanguages, ...pe(o)])
829
+ const a = ce(), n = Oe(e), o = ie(n.plugins, { source: t, mode: "markdown" }), l = se(o), i = { ...n, plugins: o }, c = St(t, l), s = [
830
+ .../* @__PURE__ */ new Set([...c.codeLanguages, ...le(o)])
829
831
  ], p = {
830
832
  highlightedCode: s.length > 0,
831
833
  codeLanguages: s
@@ -856,13 +858,13 @@ async function At(t, e, r = { warnedLanguages: /* @__PURE__ */ new Set() }) {
856
858
  assets: a.snapshot()
857
859
  };
858
860
  }
859
- const Jt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
861
+ const Xt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
860
862
  __proto__: null,
861
863
  prepareMarkdown: At
862
864
  }, Symbol.toStringTag, { value: "Module" }));
863
865
  export {
864
866
  nt as a,
865
- Jt as b,
867
+ Xt as b,
866
868
  Ct as c,
867
869
  St as d,
868
870
  Oe as n,
@@ -0,0 +1,8 @@
1
+ import { jsx as s } from "react/jsx-runtime";
2
+ import { a as t } from "./ImageGallery-Bcpjlfh9.js";
3
+ function a(o, r = {}) {
4
+ return /* @__PURE__ */ s(t, { slots: r.slots, children: o });
5
+ }
6
+ export {
7
+ a as w
8
+ };
@@ -0,0 +1,39 @@
1
+ import { jsxs as c, jsx as m, Fragment as u } from "react/jsx-runtime";
2
+ import { toJsxRuntime as l } from "hast-util-to-jsx-runtime";
3
+ import { isValidElement as p, cloneElement as f } from "react";
4
+ import { d as i, c as y } from "./componentMap-CKSUGzQH.js";
5
+ function v(e) {
6
+ return !!(e && typeof e == "object" && typeof e.type == "string");
7
+ }
8
+ function d(e, r = {}, t = !0) {
9
+ return l(e, {
10
+ Fragment: u,
11
+ jsx: m,
12
+ jsxs: c,
13
+ components: t ? y(r.classNames, r.slots, r.components) : void 0,
14
+ passNode: !0
15
+ });
16
+ }
17
+ function j(e, r = {}) {
18
+ try {
19
+ const t = i(e);
20
+ return t ? d(t, r) : void 0;
21
+ } catch {
22
+ return;
23
+ }
24
+ }
25
+ function w(e, r = {}, t = !0) {
26
+ try {
27
+ const n = i(e);
28
+ return !n || !("children" in n) || !Array.isArray(n.children) ? void 0 : n.children.filter(v).map((a, s) => {
29
+ const o = a.type === "text" ? a.value : d(a, r, t);
30
+ return p(o) && o.key === null ? f(o, { key: `markdown-node-${s}` }) : o;
31
+ });
32
+ } catch {
33
+ return;
34
+ }
35
+ }
36
+ export {
37
+ j as a,
38
+ w as r
39
+ };
@@ -1,13 +1,13 @@
1
- import { n as w, c as x } from "../directiveValidation-BdVbgcY_.js";
2
- import { d as V } from "../directiveValidation-BdVbgcY_.js";
3
- import b from "github-slugger";
4
- import { remarkDefinitionList as D } from "remark-definition-list";
5
- import M from "remark-directive";
6
- import E from "remark-gfm";
7
- import S from "remark-parse";
8
- import { unified as I } from "unified";
1
+ import { d as V } from "../assets-CqlggKr8.js";
2
+ import w from "github-slugger";
3
+ import { remarkDefinitionList as x } from "remark-definition-list";
4
+ import b from "remark-directive";
5
+ import D from "remark-gfm";
6
+ import M from "remark-parse";
7
+ import { unified as E } from "unified";
9
8
  import { visit as k } from "unist-util-visit";
10
- import { a as j, n as C, m as A } from "../plugins-StkCS2su.js";
9
+ import { n as S, c as I } from "../directiveValidation-B7LY-R5p.js";
10
+ import { a as j, n as C, m as A } from "../plugins-CXYBB-oH.js";
11
11
  import { createProcessor as L } from "@mdx-js/mdx";
12
12
  function P(t) {
13
13
  return "children" in t && Array.isArray(t.children);
@@ -16,7 +16,7 @@ function l(t) {
16
16
  return t.type === "text" || t.type === "inlineCode" ? String(t.value ?? "") : t.type === "image" ? String(t.alt ?? "") : t.type === "code" || t.type === "html" || t.type === "definition" ? "" : P(t) ? t.children.map(l).join(" ") : "";
17
17
  }
18
18
  function H(t, i = {}) {
19
- const n = I().use(S).use(D).use(E).use(M).parse(w(t)), c = new b(), f = [], s = [], o = [], m = [], y = [];
19
+ const n = E().use(M).use(x).use(D).use(b).parse(S(t)), c = new w(), f = [], s = [], o = [], m = [], y = [];
20
20
  let g = 0;
21
21
  const u = /* @__PURE__ */ new Map();
22
22
  k(n, "definition", (r) => {
@@ -80,7 +80,7 @@ function H(t, i = {}) {
80
80
  images: m,
81
81
  missingCodeBlockLanguages: g,
82
82
  directives: y,
83
- directiveIssues: x(n, A(v)).map(
83
+ directiveIssues: I(n, A(v)).map(
84
84
  ({ message: r, line: e, column: a }) => ({
85
85
  message: r,
86
86
  line: e,
package/dist/server.js CHANGED
@@ -1,37 +1,39 @@
1
1
  import * as f from "react/jsx-runtime";
2
- import { jsx as i } from "react/jsx-runtime";
2
+ import { jsx as u } from "react/jsx-runtime";
3
3
  import { evaluate as h } from "@mdx-js/mdx";
4
- import { c as k, a as M, b as P } from "./Markdown-CPG2lcO7.js";
5
- import { a as x, n as v } from "./directiveValidation-BdVbgcY_.js";
6
- import { n as y, d as L, c as N, a as S, p as b } from "./prepareMarkdown-DPMq7203.js";
7
- import { a as C, b as T, c as z, s as H, e as O } from "./plugins-StkCS2su.js";
8
- import { d as W } from "./plugins-StkCS2su.js";
9
- import { createHash as R } from "node:crypto";
4
+ import { b as k } from "./componentMap-CKSUGzQH.js";
5
+ import { c as M } from "./assets-CqlggKr8.js";
6
+ import { n as P, d as x, c as v, a as y, p as L } from "./prepareMarkdown-CS6sALIb.js";
7
+ import { a as N, b as S, c as b, s as C, e as T } from "./plugins-CXYBB-oH.js";
8
+ import { d as Z } from "./plugins-CXYBB-oH.js";
9
+ import { n as z } from "./directiveValidation-B7LY-R5p.js";
10
+ import { createHash as H } from "node:crypto";
11
+ import { a as O, b as R } from "./Markdown-607_slPB.js";
10
12
  async function A(a = {}, r, s = { warnedLanguages: /* @__PURE__ */ new Set() }) {
11
- const n = y(a), e = x(), t = r ?? "", o = C(n.plugins, { source: t, mode: "mdx" }), l = T(o), d = { ...n, plugins: o }, g = L(t, l), m = [
12
- .../* @__PURE__ */ new Set([...g.codeLanguages, ...z(o)])
13
- ], c = {
13
+ const n = P(a), e = M(), t = r ?? "", o = N(n.plugins, { source: t, mode: "mdx" }), l = S(o), d = { ...n, plugins: o }, g = x(t, l), m = [
14
+ .../* @__PURE__ */ new Set([...g.codeLanguages, ...b(o)])
15
+ ], i = {
14
16
  highlightedCode: m.length > 0,
15
17
  codeLanguages: m
16
18
  };
17
19
  o.forEach((w) => e.markPluginAssets(w));
18
- const p = c.highlightedCode ? await N(
19
- c.codeLanguages,
20
+ const p = i.highlightedCode ? await v(
21
+ i.codeLanguages,
20
22
  d,
21
23
  s.warnedLanguages,
22
24
  l
23
- ) : void 0, u = S("mdx", e, d, c, p);
25
+ ) : void 0, c = y("mdx", e, d, i, p);
24
26
  return {
25
- remarkPlugins: u.remarkPlugins,
26
- rehypePlugins: u.rehypePlugins,
27
- remarkRehypeOptions: { handlers: u.handlers },
27
+ remarkPlugins: c.remarkPlugins,
28
+ rehypePlugins: c.rehypePlugins,
29
+ remarkRehypeOptions: { handlers: c.handlers },
28
30
  getAssets: () => e.snapshot()
29
31
  };
30
32
  }
31
33
  function F(a, r) {
32
- const { plugins: s, ...n } = r ?? {}, e = H({ ...n, plugins: O(s) });
34
+ const { plugins: s, ...n } = r ?? {}, e = C({ ...n, plugins: T(s) });
33
35
  if (e !== void 0)
34
- return R("sha256").update(a).update("\0").update(e).digest("hex");
36
+ return H("sha256").update(a).update("\0").update(e).digest("hex");
35
37
  }
36
38
  function D(a, r, s, n) {
37
39
  for (a.delete(r), a.set(r, s); a.size > n; ) {
@@ -61,7 +63,7 @@ function K({
61
63
  return J(
62
64
  n,
63
65
  F(e, t),
64
- () => b(e, t, { warnedLanguages: r }),
66
+ () => L(e, t, { warnedLanguages: r }),
65
67
  s
66
68
  );
67
69
  },
@@ -70,14 +72,14 @@ function K({
70
72
  }
71
73
  };
72
74
  }
73
- function G(a = {}) {
75
+ function V(a = {}) {
74
76
  const r = /* @__PURE__ */ new Set(), s = K({ ...a, warningState: r });
75
77
  return {
76
78
  async render(n, e = {}) {
77
79
  const t = await s.prepare(n, e.markdown);
78
80
  return {
79
- content: /* @__PURE__ */ i(
80
- P,
81
+ content: /* @__PURE__ */ u(
82
+ R,
81
83
  {
82
84
  document: t.document,
83
85
  classNames: e.classNames,
@@ -99,7 +101,7 @@ function G(a = {}) {
99
101
  warnedLanguages: r
100
102
  }), l = (await h(
101
103
  {
102
- value: v(n),
104
+ value: z(n),
103
105
  data: { canofoldLocale: e.markdown?.locale?.trim() || void 0 }
104
106
  },
105
107
  {
@@ -116,8 +118,8 @@ function G(a = {}) {
116
118
  e.urlTransform
117
119
  );
118
120
  return {
119
- content: /* @__PURE__ */ i(
120
- M,
121
+ content: /* @__PURE__ */ u(
122
+ O,
121
123
  {
122
124
  "data-cf-runtime": "static",
123
125
  as: e.as,
@@ -125,7 +127,7 @@ function G(a = {}) {
125
127
  classNames: e.classNames,
126
128
  slots: e.slots,
127
129
  urlTransform: e.urlTransform,
128
- children: /* @__PURE__ */ i(l, { components: d })
130
+ children: /* @__PURE__ */ u(l, { components: d })
129
131
  }
130
132
  ),
131
133
  assets: t.getAssets()
@@ -137,6 +139,6 @@ function G(a = {}) {
137
139
  };
138
140
  }
139
141
  export {
140
- G as createMarkdownRenderer,
141
- W as defineMarkdownPlugin
142
+ V as createMarkdownRenderer,
143
+ Z as defineMarkdownPlugin
142
144
  };