@docubook/core 2.0.0-beta.4 → 2.0.0-beta.5
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.
- package/README.md +3 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.js +99 -97
- package/dist/index.js.map +1 -1
- package/dist/plugins/rehypeCollectTocs.d.ts +4 -0
- package/dist/plugins/remarkDirectiveToMdx.d.ts +2 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -68,8 +68,9 @@ boolean props. Nested containers need a longer outer fence (`::::`).
|
|
|
68
68
|
| `MDXRemote` | Client-side renderer for pre-compiled `serialize()` output | React component |
|
|
69
69
|
| `extractFrontmatter` | Parse frontmatter only | `Frontmatter` |
|
|
70
70
|
| `extractFrontmatterWithContent` | Extract frontmatter and stripped content in one pass (avoids double parsing) | `{ frontmatter, strippedContent }` |
|
|
71
|
-
| `extractTocsFromRawMdx` |
|
|
72
|
-
| `
|
|
71
|
+
| `extractTocsFromRawMdx` | Synchronously extract h2–h4 from Markdown/directives using default heading IDs; strips frontmatter | `TocItem[]` |
|
|
72
|
+
| `rehypeCollectTocs` | Append `[rehypeCollectTocs, tocs]` after slugging and custom rehype plugins to collect final heading IDs during compilation | transformer |
|
|
73
|
+
| `sluggify` | Legacy ASCII slug helper; not used for compiler heading IDs | `string` |
|
|
73
74
|
| `createDefaultRehypePlugins` | Default rehype plugin stack | `Pluggable[]` |
|
|
74
75
|
| `createDefaultRemarkPlugins` | Default remark stack (GFM, expandable, directives) | `Pluggable[]` |
|
|
75
76
|
| `remarkDirectiveToMdx` | Convert `:::name{attrs}` directives into MDX component elements | transformer |
|
package/dist/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export { serialize, MDXRemote, preProcess, postProcess, createDefaultRehypePlugi
|
|
|
4
4
|
export { handleCodeTitles } from "./plugins/handleCodeTitles";
|
|
5
5
|
export { handleCodeExpandableRemark, handleCodeExpandable } from "./plugins/handleCodeExpandable";
|
|
6
6
|
export { rehypeMermaid } from "./plugins/rehypeMermaid";
|
|
7
|
+
export { rehypeCollectTocs } from "./plugins/rehypeCollectTocs";
|
|
7
8
|
export { remarkDirectiveToMdx } from "./plugins/remarkDirectiveToMdx";
|
|
8
9
|
export { extractFrontmatter, extractFrontmatterWithContent, extractTocsFromRawMdx, sluggify, } from "./extract";
|
|
9
10
|
export type { MDXRemoteProps } from "./mdx-compiler/index";
|
package/dist/index.js
CHANGED
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
import { cn as e, formatDate as t, formatDate2 as n, parseDate as r, stringToDate as i, toIsoDateOnly as a } from "./utils.js";
|
|
2
2
|
import { t as o } from "./serialize-DEuXE4Xm.js";
|
|
3
|
-
import {
|
|
4
|
-
import c from "
|
|
5
|
-
import l from "
|
|
6
|
-
import u from "rehype-
|
|
7
|
-
import d from "rehype-
|
|
8
|
-
import f from "rehype-
|
|
9
|
-
import p from "
|
|
10
|
-
import m
|
|
11
|
-
import
|
|
12
|
-
import * as y from "react/jsx-
|
|
13
|
-
import * as b from "
|
|
14
|
-
import x from "@
|
|
3
|
+
import { compileSync as s } from "@mdx-js/mdx";
|
|
4
|
+
import { visit as c } from "unist-util-visit";
|
|
5
|
+
import l from "remark-gfm";
|
|
6
|
+
import u from "rehype-prism-plus";
|
|
7
|
+
import d from "rehype-autolink-headings";
|
|
8
|
+
import f from "rehype-slug";
|
|
9
|
+
import p from "rehype-code-titles";
|
|
10
|
+
import m from "remark-directive";
|
|
11
|
+
import h, { useEffect as g, useMemo as _, useState as v } from "react";
|
|
12
|
+
import * as y from "react/jsx-runtime";
|
|
13
|
+
import * as b from "react/jsx-dev-runtime";
|
|
14
|
+
import * as x from "@mdx-js/react";
|
|
15
|
+
import S from "@11ty/gray-matter";
|
|
15
16
|
//#region src/plugins/handleCodeTitles.ts
|
|
16
|
-
var
|
|
17
|
+
var C = () => (e) => {
|
|
17
18
|
let t = [];
|
|
18
|
-
|
|
19
|
+
c(e, "element", (e, n, r) => {
|
|
19
20
|
if (!r || n === null || e.tagName !== "div" || !e.properties?.className?.includes("rehype-code-title")) return;
|
|
20
21
|
let i = null;
|
|
21
22
|
for (let e = n + 1; e < r.children.length; e++) {
|
|
@@ -40,7 +41,7 @@ var S = () => (e) => {
|
|
|
40
41
|
};
|
|
41
42
|
//#endregion
|
|
42
43
|
//#region src/plugins/handleCodeExpandable.ts
|
|
43
|
-
function
|
|
44
|
+
function w(e) {
|
|
44
45
|
let t = "";
|
|
45
46
|
for (let n = 0; n < e.length; n++) {
|
|
46
47
|
let r = e[n];
|
|
@@ -56,29 +57,29 @@ function C(e) {
|
|
|
56
57
|
}
|
|
57
58
|
return t;
|
|
58
59
|
}
|
|
59
|
-
function
|
|
60
|
+
function T(e) {
|
|
60
61
|
let t = e.replace(/\r\n/g, "\n");
|
|
61
62
|
return t.startsWith("\n") && (t = t.slice(1)), t.endsWith("\n") && (t = t.slice(0, -1)), t.length === 0 ? 0 : t.split("\n").length;
|
|
62
63
|
}
|
|
63
|
-
var
|
|
64
|
-
|
|
64
|
+
var E = () => (e) => {
|
|
65
|
+
c(e, "code", (e) => {
|
|
65
66
|
if (!e.meta) return;
|
|
66
67
|
let t = e.meta.includes("Expandable"), [n, r] = (e.lang ?? "").split(":"), i = n?.trim(), a = r?.trim();
|
|
67
68
|
if (!t) return;
|
|
68
|
-
let o =
|
|
69
|
+
let o = T(e.value);
|
|
69
70
|
e.data ||= {}, e.data.hProperties || (e.data.hProperties = {}), e.data.hProperties["data-expandable"] = "true", e.data.hProperties["data-expandable-lines"] = o.toString(), i && (e.data.hProperties["data-language"] = i), a && (e.data.hProperties["data-title"] = a);
|
|
70
71
|
let s = e.data.hProperties.className, c = Array.isArray(s) ? s : typeof s == "string" ? s.split(" ").filter(Boolean) : [];
|
|
71
|
-
c.includes("mdx-expandable-meta") || c.push("mdx-expandable-meta"), e.data.hProperties.className = c, i && !e.meta.includes("dbLang(") && (e.meta = `${e.meta} dbLang(${
|
|
72
|
+
c.includes("mdx-expandable-meta") || c.push("mdx-expandable-meta"), e.data.hProperties.className = c, i && !e.meta.includes("dbLang(") && (e.meta = `${e.meta} dbLang(${w(i)})`.trim()), a && !e.meta.includes("dbTitle(") && (e.meta = `${e.meta} dbTitle(${w(a)})`.trim());
|
|
72
73
|
});
|
|
73
|
-
},
|
|
74
|
-
|
|
74
|
+
}, D = () => (e) => {
|
|
75
|
+
c(e, "element", (e) => {
|
|
75
76
|
if (e.tagName !== "pre") return;
|
|
76
77
|
let t = e.children?.find((e) => {
|
|
77
78
|
let t = e;
|
|
78
79
|
return t.type === "element" && t.tagName === "code";
|
|
79
80
|
}), n = t?.properties?.className, r = Array.isArray(n) ? n : typeof n == "string" ? n.split(" ").filter(Boolean) : [], i = t?.data && typeof t.data == "object" && typeof t.data.meta == "string" ? t.data.meta : void 0, a = i?.match(/dbLang\(([^)]+)\)/)?.[1], o = i?.match(/dbTitle\(([^)]+)\)/)?.[1], s = typeof t?.properties?.["data-language"] == "string" ? t.properties["data-language"] : void 0, c = typeof t?.properties?.["data-title"] == "string" ? t.properties["data-title"] : void 0, l = r.find((e) => e.startsWith("language-"))?.replace("language-", ""), u = typeof e.properties?.["data-language"] == "string" ? e.properties["data-language"] : void 0, d = typeof e.properties?.["data-title"] == "string" ? e.properties["data-title"] : void 0, f = t?.properties?.["data-expandable"] === "true" || r.includes("mdx-expandable-meta") || i?.includes("Expandable") === !0, p = t?.properties?.["data-expandable-lines"];
|
|
80
81
|
if (!f) return;
|
|
81
|
-
e.properties ||= {}, e.properties["data-expandable"] = "true", typeof p == "string" || typeof p == "number" ? e.properties["data-expandable-lines"] = p.toString() : e.raw && (e.properties["data-expandable-lines"] =
|
|
82
|
+
e.properties ||= {}, e.properties["data-expandable"] = "true", typeof p == "string" || typeof p == "number" ? e.properties["data-expandable-lines"] = p.toString() : e.raw && (e.properties["data-expandable-lines"] = T(e.raw).toString());
|
|
82
83
|
let m = s || a || l || u || e.language, h = c || o || d || e.codeTitle;
|
|
83
84
|
m && (e.properties["data-language"] = m), h && (e.properties["data-title"] = h);
|
|
84
85
|
let g = e.properties.className;
|
|
@@ -87,8 +88,8 @@ var T = () => (e) => {
|
|
|
87
88
|
t.properties.className = e;
|
|
88
89
|
}
|
|
89
90
|
});
|
|
90
|
-
},
|
|
91
|
-
|
|
91
|
+
}, O = () => (e) => {
|
|
92
|
+
c(e, "element", (e, t, n) => {
|
|
92
93
|
if (!n || t === null || e.tagName !== "pre") return;
|
|
93
94
|
let r = e.children?.find((e) => e.type === "element" && e.tagName === "code");
|
|
94
95
|
if (!r || !(Array.isArray(r.properties?.className) ? r.properties.className : typeof r.properties?.className == "string" ? r.properties.className.split(" ").filter(Boolean) : []).includes("language-mermaid")) return;
|
|
@@ -103,27 +104,27 @@ var T = () => (e) => {
|
|
|
103
104
|
};
|
|
104
105
|
//#endregion
|
|
105
106
|
//#region src/plugins/remarkDirectiveToMdx.ts
|
|
106
|
-
function
|
|
107
|
-
return (e) => {
|
|
108
|
-
let t = e;
|
|
109
|
-
return
|
|
107
|
+
function k() {
|
|
108
|
+
return (e, t) => {
|
|
109
|
+
let n = String(t), r = e;
|
|
110
|
+
return r.children = r.children.map((e) => M(e, n)), e;
|
|
110
111
|
};
|
|
111
112
|
}
|
|
112
|
-
var
|
|
113
|
-
function
|
|
113
|
+
var A = /* @__PURE__ */ new Set(["youtube"]);
|
|
114
|
+
function j(e) {
|
|
114
115
|
return e.type === "containerDirective" || e.type === "leafDirective" || e.type === "textDirective";
|
|
115
116
|
}
|
|
116
|
-
function
|
|
117
|
-
if (!
|
|
118
|
-
let
|
|
119
|
-
return Array.isArray(
|
|
117
|
+
function M(e, t) {
|
|
118
|
+
if (!j(e)) {
|
|
119
|
+
let n = e.children;
|
|
120
|
+
return Array.isArray(n) && (e.children = n.map((e) => M(e, t))), e;
|
|
120
121
|
}
|
|
121
|
-
return e.type === "textDirective" ? e.name === "tooltip" ?
|
|
122
|
+
return e.type === "textDirective" ? e.name === "tooltip" ? F(e) : P(e, t) : e.type === "leafDirective" && e.name === "tooltip" ? P(e, t) : N(e, e.type === "containerDirective" && !A.has(e.name) ? (e.children ?? []).map((e) => M(e, t)) : []);
|
|
122
123
|
}
|
|
123
|
-
function
|
|
124
|
+
function N(e, t) {
|
|
124
125
|
return {
|
|
125
126
|
type: "mdxJsxFlowElement",
|
|
126
|
-
name:
|
|
127
|
+
name: I(e.name),
|
|
127
128
|
attributes: Object.entries(e.attributes ?? {}).map(([e, t]) => ({
|
|
128
129
|
type: "mdxJsxAttribute",
|
|
129
130
|
name: e,
|
|
@@ -132,14 +133,14 @@ function M(e, t) {
|
|
|
132
133
|
children: t
|
|
133
134
|
};
|
|
134
135
|
}
|
|
135
|
-
function
|
|
136
|
-
let
|
|
137
|
-
return {
|
|
136
|
+
function P(e, t) {
|
|
137
|
+
let n = e.position?.start.offset, r = e.position?.end.offset;
|
|
138
|
+
return n === void 0 || r === void 0 ? e : {
|
|
138
139
|
type: "text",
|
|
139
|
-
value: t
|
|
140
|
+
value: t.slice(n, r)
|
|
140
141
|
};
|
|
141
142
|
}
|
|
142
|
-
function
|
|
143
|
+
function F(e) {
|
|
143
144
|
let t = (e.children ?? []).map((e) => e.value ?? "").join(""), n = e.attributes ?? {};
|
|
144
145
|
return {
|
|
145
146
|
type: "mdxJsxTextElement",
|
|
@@ -156,26 +157,26 @@ function P(e) {
|
|
|
156
157
|
children: []
|
|
157
158
|
};
|
|
158
159
|
}
|
|
159
|
-
function
|
|
160
|
+
function I(e) {
|
|
160
161
|
return e.split("-").map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join("");
|
|
161
162
|
}
|
|
162
163
|
//#endregion
|
|
163
164
|
//#region src/mdx-compiler/index.ts
|
|
164
|
-
function
|
|
165
|
-
let [a, o] =
|
|
166
|
-
|
|
165
|
+
function L({ compiledSource: e, frontmatter: t, scope: n = {}, components: r = {}, lazy: i }) {
|
|
166
|
+
let [a, o] = v(!i || typeof window > "u");
|
|
167
|
+
g(() => {
|
|
167
168
|
if (!i) return;
|
|
168
169
|
let e = window.requestIdleCallback ? window.requestIdleCallback(() => o(!0), { timeout: 500 }) : setTimeout(() => o(!0), 1);
|
|
169
170
|
return () => {
|
|
170
171
|
window.cancelIdleCallback ? window.cancelIdleCallback(e) : clearTimeout(e);
|
|
171
172
|
};
|
|
172
173
|
}, [i]);
|
|
173
|
-
let s =
|
|
174
|
+
let s = _(() => {
|
|
174
175
|
let r = {
|
|
175
176
|
opts: {
|
|
176
|
-
...
|
|
177
|
-
...
|
|
178
|
-
...
|
|
177
|
+
...x,
|
|
178
|
+
...y,
|
|
179
|
+
...b
|
|
179
180
|
},
|
|
180
181
|
frontmatter: t,
|
|
181
182
|
...n
|
|
@@ -186,16 +187,16 @@ function I({ compiledSource: e, frontmatter: t, scope: n = {}, components: r = {
|
|
|
186
187
|
n,
|
|
187
188
|
t
|
|
188
189
|
]);
|
|
189
|
-
if (!a) return
|
|
190
|
+
if (!a) return h.createElement("div", {
|
|
190
191
|
dangerouslySetInnerHTML: { __html: "" },
|
|
191
192
|
suppressHydrationWarning: !0
|
|
192
193
|
});
|
|
193
|
-
let c =
|
|
194
|
-
return i ?
|
|
194
|
+
let c = h.createElement(x.MDXProvider, { components: r }, h.createElement(s, null));
|
|
195
|
+
return i ? h.createElement("div", null, c) : c;
|
|
195
196
|
}
|
|
196
197
|
//#endregion
|
|
197
198
|
//#region src/compile.ts
|
|
198
|
-
var
|
|
199
|
+
var R = () => (e) => (c(e, (e) => {
|
|
199
200
|
let t = e;
|
|
200
201
|
if (t?.type === "element" && t?.tagName === "pre" && t.children) {
|
|
201
202
|
let [e] = t.children;
|
|
@@ -205,72 +206,73 @@ var L = () => (e) => (s(e, (e) => {
|
|
|
205
206
|
let i = e.children[0];
|
|
206
207
|
i.type === "text" && i.value && (t.raw = i.value);
|
|
207
208
|
}
|
|
208
|
-
}), e),
|
|
209
|
+
}), e), z = () => (e) => (c(e, "element", (e) => {
|
|
209
210
|
let t = e;
|
|
210
211
|
t?.type === "element" && t?.tagName === "pre" && (t.properties && t.raw && (t.properties.raw = t.raw), t.properties && t.language && !t.properties["data-language"] && (t.properties["data-language"] = t.language), t.properties && t.codeTitle && !t.properties["data-title"] && (t.properties["data-title"] = t.codeTitle));
|
|
211
212
|
}), e);
|
|
212
|
-
function
|
|
213
|
+
function B() {
|
|
213
214
|
return [
|
|
214
|
-
|
|
215
|
+
R,
|
|
216
|
+
O,
|
|
217
|
+
p,
|
|
218
|
+
C,
|
|
219
|
+
D,
|
|
220
|
+
u,
|
|
215
221
|
D,
|
|
216
222
|
f,
|
|
217
|
-
S,
|
|
218
|
-
E,
|
|
219
|
-
l,
|
|
220
|
-
E,
|
|
221
223
|
d,
|
|
222
|
-
|
|
223
|
-
R
|
|
224
|
+
z
|
|
224
225
|
];
|
|
225
226
|
}
|
|
226
|
-
function
|
|
227
|
+
function V() {
|
|
227
228
|
return [
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
229
|
+
l,
|
|
230
|
+
E,
|
|
231
|
+
m,
|
|
232
|
+
k
|
|
232
233
|
];
|
|
233
234
|
}
|
|
234
235
|
//#endregion
|
|
235
|
-
//#region src/
|
|
236
|
-
|
|
236
|
+
//#region src/plugins/rehypeCollectTocs.ts
|
|
237
|
+
function H(e) {
|
|
238
|
+
let t = e;
|
|
239
|
+
return t.properties?.ariaHidden === !0 || t.properties?.ariaHidden === "true" ? "" : e.type === "text" ? e.value : t.children?.map(H).join("") ?? "";
|
|
240
|
+
}
|
|
237
241
|
function U(e) {
|
|
238
|
-
return
|
|
242
|
+
return (t) => {
|
|
243
|
+
e.length = 0, c(t, "element", (t) => {
|
|
244
|
+
!/^h[2-4]$/.test(t.tagName ?? "") || typeof t.properties?.id != "string" || e.push({
|
|
245
|
+
level: Number(t.tagName.slice(1)),
|
|
246
|
+
text: H(t),
|
|
247
|
+
href: `#${t.properties.id}`
|
|
248
|
+
});
|
|
249
|
+
});
|
|
250
|
+
};
|
|
239
251
|
}
|
|
252
|
+
//#endregion
|
|
253
|
+
//#region src/extract.ts
|
|
240
254
|
function W(e) {
|
|
241
|
-
|
|
242
|
-
for (let e of n) {
|
|
243
|
-
let n = e.trimStart(), a = V.exec(n);
|
|
244
|
-
if (a) {
|
|
245
|
-
let e = a[1];
|
|
246
|
-
r ? e.length === i && (r = !1) : (r = !0, i = e.length);
|
|
247
|
-
continue;
|
|
248
|
-
}
|
|
249
|
-
if (r) continue;
|
|
250
|
-
let o = H.exec(n);
|
|
251
|
-
if (o) {
|
|
252
|
-
let e = o[1].length, n = o[2].trim().replace(/\s+#+\s*$/, "");
|
|
253
|
-
t.push({
|
|
254
|
-
level: e,
|
|
255
|
-
text: n,
|
|
256
|
-
href: `#${U(n)}`
|
|
257
|
-
});
|
|
258
|
-
continue;
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
return t;
|
|
255
|
+
return e.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase().replace(/\s+/g, "-").replace(/[^a-z0-9-]/g, "");
|
|
262
256
|
}
|
|
263
257
|
function G(e) {
|
|
258
|
+
let t = [];
|
|
259
|
+
return s(S(e).content, {
|
|
260
|
+
format: "md",
|
|
261
|
+
remarkPlugins: V(),
|
|
262
|
+
rehypePlugins: [f, [U, t]]
|
|
263
|
+
}), t;
|
|
264
|
+
}
|
|
265
|
+
function K(e) {
|
|
264
266
|
try {
|
|
265
|
-
return
|
|
267
|
+
return S(e).data;
|
|
266
268
|
} catch (e) {
|
|
267
269
|
let t = e instanceof Error ? e.message : String(e);
|
|
268
270
|
throw Error(`Failed to extract frontmatter: ${t}`, { cause: e });
|
|
269
271
|
}
|
|
270
272
|
}
|
|
271
|
-
function
|
|
273
|
+
function q(e, t) {
|
|
272
274
|
try {
|
|
273
|
-
let { data: n, content: r } =
|
|
275
|
+
let { data: n, content: r } = S(e);
|
|
274
276
|
return {
|
|
275
277
|
frontmatter: t ? t.parse(n) : n,
|
|
276
278
|
strippedContent: r
|
|
@@ -281,6 +283,6 @@ function K(e, t) {
|
|
|
281
283
|
}
|
|
282
284
|
}
|
|
283
285
|
//#endregion
|
|
284
|
-
export {
|
|
286
|
+
export { L as MDXRemote, e as cn, B as createDefaultRehypePlugins, V as createDefaultRemarkPlugins, K as extractFrontmatter, q as extractFrontmatterWithContent, G as extractTocsFromRawMdx, t as formatDate, n as formatDate2, D as handleCodeExpandable, E as handleCodeExpandableRemark, C as handleCodeTitles, r as parseDate, z as postProcess, R as preProcess, U as rehypeCollectTocs, O as rehypeMermaid, k as remarkDirectiveToMdx, o as serialize, W as sluggify, i as stringToDate, a as toIsoDateOnly };
|
|
285
287
|
|
|
286
288
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../src/plugins/handleCodeTitles.ts","../src/plugins/handleCodeExpandable.ts","../src/plugins/rehypeMermaid.ts","../src/plugins/remarkDirectiveToMdx.ts","../src/mdx-compiler/index.ts","../src/compile.ts","../src/extract.ts"],"sourcesContent":["import type { Node, Parent } from \"unist\";\nimport { visit } from \"unist-util-visit\";\nimport type { ElementNode } from \"../utils\";\n\ninterface TextNode extends Node {\n type: \"text\";\n value: string;\n}\n\nexport const handleCodeTitles = () => (tree: Node) => {\n const toRemove: { parent: Parent; index: number }[] = [];\n\n visit(tree, \"element\", (node: ElementNode, index: number | null, parent: Parent | null) => {\n if (!parent || index === null || node.tagName !== \"div\") {\n return;\n }\n\n const isTitleDiv = node.properties?.className?.includes(\"rehype-code-title\");\n if (!isTitleDiv) {\n return;\n }\n\n let nextElement: ElementNode | null = null;\n for (let i = index + 1; i < parent.children.length; i++) {\n const sibling = parent.children[i];\n if (sibling.type === \"element\") {\n nextElement = sibling as ElementNode;\n break;\n }\n }\n\n if (nextElement?.tagName === \"pre\") {\n const titleNode = node.children?.[0] as TextNode;\n if (titleNode?.type === \"text\") {\n if (!nextElement.properties) {\n nextElement.properties = {};\n }\n nextElement.properties[\"data-title\"] = titleNode.value;\n nextElement.codeTitle = titleNode.value;\n toRemove.push({ parent, index });\n }\n }\n });\n\n // Remove title divs in reverse order to preserve indices\n for (let i = toRemove.length - 1; i >= 0; i--) {\n const { parent, index } = toRemove[i];\n parent.children.splice(index, 1);\n }\n};\n","import type { Node } from \"unist\";\nimport { visit } from \"unist-util-visit\";\nimport type { ElementNode } from \"../utils\";\n\n/**\n * Escape metadata values that are interpolated into MDX-compiled JavaScript.\n *\n * References:\n * - HTML spec (script data state): escape `</` as `\\u003C/` to prevent premature\n * `</script>` closing when the compiled JS is embedded as JSON in a <script> tag.\n * - Bun.escapeHTML(): escapes `< > \" ' &` for HTML context; for JS/JSON context\n * we use `\\uXXXX` JSON Unicode escapes instead so the value survives round-trip\n * through JSON.parse on the client side.\n * - React: JSX auto-escapes attribute values via `{expression}`, so values set\n * as HAST properties (data-language, data-title) are HTML-safe at render time.\n */\nfunction escapeMeta(s: string): string {\n let out = \"\";\n for (let i = 0; i < s.length; i++) {\n const ch = s[i];\n\n // HTML spec: prevent </script> in script/JSON context\n if (ch === \"<\" && s[i + 1] === \"/\") {\n out += \"\\\\u003C/\";\n i++;\n continue;\n }\n\n // JS string: escape template literal & string special chars\n if (ch === \"`\" || ch === \"$\" || ch === \"{\" || ch === \"}\" || ch === '\"' || ch === \"\\\\\") {\n out += `\\\\${ch}`;\n continue;\n }\n\n out += ch;\n }\n return out;\n}\n\ninterface CodeNode extends Node {\n type: \"code\";\n lang?: string;\n meta?: string;\n value: string;\n data?: {\n meta?: string;\n hProperties?: Record<string, unknown>;\n };\n}\n\nfunction countCodeLines(raw: string): number {\n let normalized = raw.replace(/\\r\\n/g, \"\\n\");\n if (normalized.startsWith(\"\\n\")) normalized = normalized.slice(1);\n if (normalized.endsWith(\"\\n\")) normalized = normalized.slice(0, -1);\n\n if (normalized.length === 0) return 0;\n return normalized.split(\"\\n\").length;\n}\n\nexport const handleCodeExpandableRemark = () => (tree: Node) => {\n visit(tree, \"code\", (node: CodeNode) => {\n if (!node.meta) return;\n\n const isExpandable = node.meta.includes(\"Expandable\");\n const [languagePart, titlePart] = (node.lang ?? \"\").split(\":\");\n const normalizedLanguage = languagePart?.trim();\n const normalizedTitle = titlePart?.trim();\n\n if (!isExpandable) return;\n\n const lineCount = countCodeLines(node.value);\n\n if (!node.data) {\n node.data = {};\n }\n if (!node.data.hProperties) {\n node.data.hProperties = {};\n }\n\n node.data.hProperties[\"data-expandable\"] = \"true\";\n node.data.hProperties[\"data-expandable-lines\"] = lineCount.toString();\n\n if (normalizedLanguage) {\n node.data.hProperties[\"data-language\"] = normalizedLanguage;\n }\n if (normalizedTitle) {\n node.data.hProperties[\"data-title\"] = normalizedTitle;\n }\n\n const currentClassName = node.data.hProperties.className;\n const classList = Array.isArray(currentClassName)\n ? currentClassName\n : typeof currentClassName === \"string\"\n ? currentClassName.split(\" \").filter(Boolean)\n : [];\n\n if (!classList.includes(\"mdx-expandable-meta\")) {\n classList.push(\"mdx-expandable-meta\");\n }\n\n node.data.hProperties.className = classList;\n\n if (normalizedLanguage && !node.meta.includes(\"dbLang(\")) {\n node.meta = `${node.meta} dbLang(${escapeMeta(normalizedLanguage)})`.trim();\n }\n if (normalizedTitle && !node.meta.includes(\"dbTitle(\")) {\n node.meta = `${node.meta} dbTitle(${escapeMeta(normalizedTitle)})`.trim();\n }\n });\n};\n\nexport const handleCodeExpandable = () => (tree: Node) => {\n visit(tree, \"element\", (node: ElementNode) => {\n if (node.tagName !== \"pre\") return;\n\n const codeElement = node.children?.find((child) => {\n const element = child as ElementNode;\n return element.type === \"element\" && element.tagName === \"code\";\n }) as ElementNode | undefined;\n\n const codeClassName = codeElement?.properties?.className;\n const codeClassList = Array.isArray(codeClassName)\n ? codeClassName\n : typeof codeClassName === \"string\"\n ? codeClassName.split(\" \").filter(Boolean)\n : [];\n\n const codeMeta =\n codeElement?.data &&\n typeof codeElement.data === \"object\" &&\n typeof codeElement.data[\"meta\"] === \"string\"\n ? (codeElement.data[\"meta\"] as string)\n : undefined;\n\n const languageFromMeta = codeMeta?.match(/dbLang\\(([^)]+)\\)/)?.[1];\n const titleFromMeta = codeMeta?.match(/dbTitle\\(([^)]+)\\)/)?.[1];\n\n const languageFromProps =\n typeof codeElement?.properties?.[\"data-language\"] === \"string\"\n ? (codeElement.properties[\"data-language\"] as string)\n : undefined;\n const titleFromProps =\n typeof codeElement?.properties?.[\"data-title\"] === \"string\"\n ? (codeElement.properties[\"data-title\"] as string)\n : undefined;\n\n const languageFromCodeClass = codeClassList\n .find((item) => item.startsWith(\"language-\"))\n ?.replace(\"language-\", \"\");\n\n const existingPreLanguage =\n typeof node.properties?.[\"data-language\"] === \"string\"\n ? (node.properties[\"data-language\"] as string)\n : undefined;\n const existingPreTitle =\n typeof node.properties?.[\"data-title\"] === \"string\"\n ? (node.properties[\"data-title\"] as string)\n : undefined;\n\n const isExpandable =\n codeElement?.properties?.[\"data-expandable\"] === \"true\" ||\n codeClassList.includes(\"mdx-expandable-meta\") ||\n codeMeta?.includes(\"Expandable\") === true;\n\n const expandableLines = codeElement?.properties?.[\"data-expandable-lines\"];\n if (!isExpandable) return;\n\n if (!node.properties) {\n node.properties = {};\n }\n\n node.properties[\"data-expandable\"] = \"true\";\n if (typeof expandableLines === \"string\" || typeof expandableLines === \"number\") {\n node.properties[\"data-expandable-lines\"] = expandableLines.toString();\n } else if (node.raw) {\n node.properties[\"data-expandable-lines\"] = countCodeLines(node.raw).toString();\n }\n\n const resolvedLanguage =\n languageFromProps ||\n languageFromMeta ||\n languageFromCodeClass ||\n existingPreLanguage ||\n node.language;\n const resolvedTitle = titleFromProps || titleFromMeta || existingPreTitle || node.codeTitle;\n\n if (resolvedLanguage) {\n node.properties[\"data-language\"] = resolvedLanguage;\n }\n if (resolvedTitle) {\n node.properties[\"data-title\"] = resolvedTitle;\n }\n\n const className = node.properties.className;\n if (!className) {\n node.properties.className = [];\n }\n\n if (Array.isArray(node.properties.className)) {\n if (!node.properties.className.includes(\"mdx-expandable-code\")) {\n node.properties.className.push(\"mdx-expandable-code\");\n }\n } else if (typeof className === \"string\") {\n const hasMarker = className.split(\" \").includes(\"mdx-expandable-code\");\n if (!hasMarker) {\n node.properties.className = `${className} mdx-expandable-code`.trim().split(\" \");\n }\n } else {\n node.properties.className = [\"mdx-expandable-code\"];\n }\n\n if (codeElement?.properties) {\n const cleanedCodeClassList = codeClassList.filter((item) => item !== \"mdx-expandable-meta\");\n codeElement.properties.className = cleanedCodeClassList;\n }\n });\n};\n","import type { Node, Parent } from \"unist\";\nimport { visit } from \"unist-util-visit\";\nimport type { ElementNode } from \"../utils\";\n\ninterface TextNode extends Node {\n type: \"text\";\n value: string;\n}\n\n/**\n * Rehype plugin that transforms `<pre><code class=\"language-mermaid\">` fenced\n * blocks into `<Mermaid chart=\"...\">` elements.\n *\n * This allows Mermaid diagram definitions to be authored via standard fenced\n * code blocks (````mermaid) which avoids JSX parsing collisions with\n * Mermaid's `{...}` (decision nodes) and `[...]` (label nodes) syntax.\n */\nexport const rehypeMermaid = () => (tree: Node) => {\n visit(tree, \"element\", (node: ElementNode, index: number | null, parent: Parent | null) => {\n if (!parent || index === null || node.tagName !== \"pre\") return;\n\n const codeEl = node.children?.find(\n (child) =>\n (child as ElementNode).type === \"element\" && (child as ElementNode).tagName === \"code\"\n ) as ElementNode | undefined;\n\n if (!codeEl) return;\n\n const classList = Array.isArray(codeEl.properties?.className)\n ? (codeEl.properties.className as string[])\n : typeof codeEl.properties?.className === \"string\"\n ? (codeEl.properties.className as string).split(\" \").filter(Boolean)\n : [];\n\n if (!classList.includes(\"language-mermaid\")) return;\n\n const textNode = codeEl.children?.find((child) => (child as TextNode).type === \"text\") as\n TextNode | undefined;\n\n const chart = textNode?.value ?? \"\";\n\n parent.children[index] = {\n type: \"element\",\n tagName: \"Mermaid\",\n properties: { chart },\n children: [],\n } as unknown as ElementNode;\n });\n};\n","import type { Node } from \"unist\";\n\n/**\n * Remark plugin: convert markdown directives into MDX component elements.\n *\n * Contract (docubook):\n * - `:::name{attrs} … :::` — container: EVERY component that holds content\n * (tabs, tab, accordions, accordion, steps, step, cards, card, files,\n * folder, note + variants). Children are the block between the opening\n * `:::` and closing `:::` — bounded by micromark's container grammar, so\n * a component can never trap siblings that follow it.\n * - `::name{attrs}` — self-closing leaf (no children): file, youtube,\n * mermaid.\n * - `:tooltip[label]{tip=\"…\"}` — the ONE inline (single-colon) directive.\n * Every other text directive is rebuilt as literal text\n * (`localhost:3000` stays intact). `::tooltip` (block leaf) is removed\n * in v2 — tooltips are inline only.\n *\n * Names are PascalCased to match the components map (`file-tree` → `FileTree`).\n * Bare attributes (`{horizontal}`) become boolean props (JSX bare attribute).\n * Callout variants (`:::tip`, `:::info`, …) map to their own registry entries\n * (`Tip`/`Info`/…) which wrap the `Callout` component with the type set.\n */\nexport function remarkDirectiveToMdx() {\n return (tree: Node) => {\n const root = tree as unknown as { children: Node[] };\n root.children = root.children.map(transform);\n return tree;\n };\n}\n\n/** Leaves that never hold children (self-closing). */\nconst PURE_LEAVES = new Set([\"youtube\"]);\n\ntype DirectiveNode = Node & {\n type: \"containerDirective\" | \"leafDirective\" | \"textDirective\";\n name: string;\n label?: string;\n attributes?: Record<string, string>;\n children?: Node[];\n};\n\nfunction isDirective(node: Node): node is DirectiveNode {\n return (\n node.type === \"containerDirective\" ||\n node.type === \"leafDirective\" ||\n node.type === \"textDirective\"\n );\n}\n\nfunction transform(node: Node): Node {\n if (!isDirective(node)) {\n const children = (node as unknown as { children?: Node[] }).children;\n if (Array.isArray(children)) {\n (node as unknown as { children: Node[] }).children = children.map(transform);\n }\n return node;\n }\n if (node.type === \"textDirective\") {\n // `:tooltip[label]{tip=\"…\"}` is the one inline component — it stays\n // inside the paragraph. Every other single-colon text directive is\n // rebuilt as literal text (`localhost:3000` stays intact).\n if (node.name === \"tooltip\") {\n return inlineTooltip(node);\n }\n return literalDirective(node);\n }\n // Block-form tooltips are gone in v2 — degrade to literal text so the\n // author sees the directive instead of a broken component.\n if (node.type === \"leafDirective\" && node.name === \"tooltip\") {\n return literalDirective(node);\n }\n // containerDirective → component with children; leafDirective → self-closing.\n const children =\n node.type === \"containerDirective\" && !PURE_LEAVES.has(node.name)\n ? (node.children ?? []).map(transform)\n : [];\n return directiveToElement(node, children);\n}\n\nfunction directiveToElement(directive: DirectiveNode, children: Node[]): Node {\n const name = pascalCase(directive.name);\n const attributes = Object.entries(directive.attributes ?? {}).map(([attrName, value]) => ({\n type: \"mdxJsxAttribute\",\n name: attrName,\n value: value === \"\" ? null : value,\n }));\n return {\n type: \"mdxJsxFlowElement\",\n name,\n attributes,\n children,\n } as Node;\n}\n\n/** Rebuild a text directive as literal text (single-colon is not a contract). */\nfunction literalDirective(directive: DirectiveNode): Node {\n const literal = \":\" + directive.name + (directive.label ? `[${directive.label}]` : \"\");\n const attrStr = Object.entries(directive.attributes ?? {})\n .map(([k, v]) => (v === \"\" ? k : `${k}=\"${v}\"`))\n .join(\" \");\n return { type: \"text\", value: literal + (attrStr ? `{${attrStr}}` : \"\") } as Node;\n}\n\n/**\n * Inline tooltip from a text directive: `:tooltip[label]{tip=\"…\"}`.\n * The label is the visible trigger (dotted underline); `tip` is the hover\n * bubble and defaults to the label, so `:tooltip[text]` alone already shows\n * a bubble. Emits an inline element so it stays inside the paragraph. The\n * bubble auto-positions (no `side` prop).\n */\nfunction inlineTooltip(directive: DirectiveNode): Node {\n const label = (directive.children ?? [])\n .map((child) => (child as { value?: string }).value ?? \"\")\n .join(\"\");\n const attrs = directive.attributes ?? {};\n const attributes = [\n { type: \"mdxJsxAttribute\", name: \"text\", value: attrs.text || label || \"?\" },\n { type: \"mdxJsxAttribute\", name: \"tip\", value: attrs.tip || label || \"\" },\n ];\n return { type: \"mdxJsxTextElement\", name: \"Tooltip\", attributes, children: [] } as Node;\n}\n\nfunction pascalCase(name: string): string {\n return name\n .split(\"-\")\n .map((part) => part.charAt(0).toUpperCase() + part.slice(1))\n .join(\"\");\n}\n","// MPL-2.0 — derived from next-mdx-remote (IBM). See LICENSE-MPL-2.0.\nimport React, { useEffect, useState, useMemo } from \"react\";\nimport * as jsxRuntime from \"react/jsx-runtime\";\nimport * as jsxDevRuntime from \"react/jsx-dev-runtime\";\nimport * as mdx from \"@mdx-js/react\";\nimport type { MDXRemoteSerializeResult } from \"./types.js\";\n\n/** Props for the client-side `<MDXRemote>` (accepts pre-serialized result). */\nexport type MDXRemoteProps = MDXRemoteSerializeResult & {\n components?: Record<string, React.ComponentType<any>>;\n /** Defer hydration to an idle callback */\n lazy?: boolean;\n};\n\n/**\n * Client-side MDX renderer.\n *\n * Accepts a pre-compiled result from `serialize()` and renders it via\n * `MDXProvider` for custom component injection.\n */\nexport function MDXRemote({\n compiledSource,\n frontmatter,\n scope = {},\n components = {},\n lazy,\n}: MDXRemoteProps): React.ReactElement {\n const [ready, setReady] = useState(!lazy || typeof window === \"undefined\");\n\n useEffect(() => {\n if (!lazy) return;\n const id = window.requestIdleCallback\n ? window.requestIdleCallback(() => setReady(true), { timeout: 500 })\n : setTimeout(() => setReady(true), 1);\n return () => {\n if (window.cancelIdleCallback) window.cancelIdleCallback(id as number);\n else clearTimeout(id as number);\n };\n }, [lazy]);\n\n const Content = useMemo(() => {\n // Non-RSC mode: compiled MDX expects `useMDXComponents` (\n // from @mdx-js/react) AND the JSX runtime.\n // In React 19, jsx/jsxs and jsxDEV live in separate modules,\n // so merge both to handle compiled output from any mode.\n const fullScope = {\n opts: { ...mdx, ...jsxRuntime, ...jsxDevRuntime },\n frontmatter,\n ...scope,\n };\n const keys = Object.keys(fullScope);\n const values = Object.values(fullScope);\n const fn = Reflect.construct(Function, keys.concat(`${compiledSource}`));\n return fn.apply(fn, values).default;\n }, [compiledSource, scope, frontmatter]);\n\n if (!ready) {\n return React.createElement(\"div\", {\n dangerouslySetInnerHTML: { __html: \"\" },\n suppressHydrationWarning: true,\n });\n }\n\n const content = React.createElement(\n mdx.MDXProvider,\n { components },\n React.createElement(Content, null)\n );\n\n return lazy ? React.createElement(\"div\", null, content) : content;\n}\n","import { serialize } from \"./mdx-compiler/serialize.js\";\nimport type { Node } from \"unist\";\nimport { visit } from \"unist-util-visit\";\nimport remarkGfm from \"remark-gfm\";\nimport rehypePrism from \"rehype-prism-plus\";\nimport rehypeAutolinkHeadings from \"rehype-autolink-headings\";\nimport rehypeSlug from \"rehype-slug\";\nimport rehypeCodeTitles from \"rehype-code-titles\";\nimport { handleCodeTitles } from \"./plugins/handleCodeTitles\";\nimport { handleCodeExpandableRemark, handleCodeExpandable } from \"./plugins/handleCodeExpandable\";\nimport { rehypeMermaid } from \"./plugins/rehypeMermaid\";\nimport { remarkDirectiveToMdx } from \"./plugins/remarkDirectiveToMdx\";\nimport remarkDirective from \"remark-directive\";\nimport type { ElementNode } from \"./utils\";\nimport type { Pluggable } from \"unified\";\n\n// Re-export serialize for non-RSC usage\nexport { serialize };\n\n// Re-export MDXRemote for client-side hydration\nexport { MDXRemote } from \"./mdx-compiler/index.js\";\n\ninterface TextNode extends Node {\n type: \"text\";\n value: string;\n}\n\nexport const preProcess = () => (tree: Node) => {\n visit(tree, (node: Node) => {\n const element = node as ElementNode;\n if (element?.type === \"element\" && element?.tagName === \"pre\" && element.children) {\n const [codeEl] = element.children as ElementNode[];\n if (codeEl.tagName !== \"code\" || !codeEl.children?.[0]) return;\n\n const className = codeEl.properties?.className;\n const classList = Array.isArray(className)\n ? className\n : typeof className === \"string\"\n ? className.split(\" \").filter(Boolean)\n : [];\n const languageClass = classList.find((item: string) => item.startsWith(\"language-\"));\n if (languageClass) {\n element.language = languageClass.replace(\"language-\", \"\").split(\":\")[0];\n }\n\n const textNode = codeEl.children[0] as TextNode;\n if (textNode.type === \"text\" && textNode.value) {\n element.raw = textNode.value;\n }\n }\n });\n\n return tree;\n};\n\nexport const postProcess = () => (tree: Node) => {\n visit(tree, \"element\", (node: Node) => {\n const element = node as ElementNode;\n if (element?.type === \"element\" && element?.tagName === \"pre\") {\n if (element.properties && element.raw) {\n element.properties.raw = element.raw;\n }\n if (element.properties && element.language && !element.properties[\"data-language\"]) {\n element.properties[\"data-language\"] = element.language;\n }\n if (element.properties && element.codeTitle && !element.properties[\"data-title\"]) {\n element.properties[\"data-title\"] = element.codeTitle;\n }\n }\n });\n\n return tree;\n};\n\nexport function createDefaultRehypePlugins(): Pluggable[] {\n return [\n preProcess,\n rehypeMermaid, // Transform ```mermaid before code transforms\n rehypeCodeTitles,\n handleCodeTitles,\n handleCodeExpandable, // Copy expandable metadata from <code> to <pre> before prism transforms nodes.\n rehypePrism,\n handleCodeExpandable, // Re-apply expandable attrs after prism tokenization.\n rehypeSlug,\n rehypeAutolinkHeadings,\n postProcess,\n ];\n}\n\nexport function createDefaultRemarkPlugins(): Pluggable[] {\n return [remarkGfm, handleCodeExpandableRemark, remarkDirective, remarkDirectiveToMdx];\n}\n","import matter from \"@11ty/gray-matter\";\nimport type { ZodType } from \"zod\";\nimport type { TocItem } from \"./types\";\n\nconst FENCE_MARKER_REGEX = /^(````|```)(?!`)/;\nconst HEADING_REGEX = /^(#{2,4})\\s+(.+)$/;\n\nexport function sluggify(text: string): string {\n const normalized = text.normalize(\"NFD\").replace(/[\\u0300-\\u036f]/g, \"\"); // Remove accents\n const slug = normalized.toLowerCase().replace(/\\s+/g, \"-\");\n return slug.replace(/[^a-z0-9-]/g, \"\");\n}\n\nexport function extractTocsFromRawMdx(rawMdx: string): TocItem[] {\n const extractedHeadings: TocItem[] = [];\n\n const lines = rawMdx.split(/\\r?\\n/);\n let inFence = false;\n let fenceLength = 0;\n\n for (const line of lines) {\n const trimmed = line.trimStart();\n\n const fenceMatch = FENCE_MARKER_REGEX.exec(trimmed);\n if (fenceMatch) {\n const marker = fenceMatch[1];\n\n if (!inFence) {\n inFence = true;\n fenceLength = marker.length;\n } else if (marker.length === fenceLength) {\n inFence = false;\n }\n\n continue;\n }\n\n if (inFence) {\n continue;\n }\n\n const headingMatch = HEADING_REGEX.exec(trimmed);\n if (headingMatch) {\n const headingLevel = headingMatch[1].length;\n const headingText = headingMatch[2].trim().replace(/\\s+#+\\s*$/, \"\");\n extractedHeadings.push({\n level: headingLevel,\n text: headingText,\n href: `#${sluggify(headingText)}`,\n });\n continue;\n }\n }\n\n return extractedHeadings;\n}\n\nexport function extractFrontmatter<Frontmatter>(content: string): Frontmatter {\n try {\n return matter(content).data as Frontmatter;\n } catch (error) {\n const reason = error instanceof Error ? error.message : String(error);\n throw new Error(`Failed to extract frontmatter: ${reason}`, { cause: error });\n }\n}\n\n/**\n * Extract frontmatter and return both the parsed data and the content\n * with the frontmatter block stripped. Avoids a second parse during\n * compilation.\n *\n * Optionally validates the parsed frontmatter with a Zod schema.\n * YAML coerces unquoted values (e.g. `date: 2026-06-10` → Date, `3.5` → number),\n * so use `z.coerce.*` for fields that must remain strings.\n */\nexport function extractFrontmatterWithContent<Frontmatter>(content: string): {\n frontmatter: Frontmatter;\n strippedContent: string;\n};\nexport function extractFrontmatterWithContent<Frontmatter>(\n content: string,\n schema: ZodType<Frontmatter>\n): { frontmatter: Frontmatter; strippedContent: string };\nexport function extractFrontmatterWithContent<Frontmatter>(\n content: string,\n schema?: ZodType<Frontmatter>\n): { frontmatter: Frontmatter; strippedContent: string } {\n try {\n const { data, content: strippedContent } = matter(content);\n return {\n frontmatter: schema ? schema.parse(data) : (data as Frontmatter),\n strippedContent,\n };\n } catch (error) {\n const reason = error instanceof Error ? error.message : String(error);\n throw new Error(`Failed to extract frontmatter: ${reason}`, { cause: error });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;AASA,IAAa,WAA0B,MAAe;CACpD,IAAM,IAAgD,CAAC;CAEvD,EAAM,GAAM,YAAY,GAAmB,GAAsB,MAA0B;EAMzF,IALI,CAAC,KAAU,MAAU,QAAQ,EAAK,YAAY,SAK9C,CADe,EAAK,YAAY,WAAW,SAAS,mBAAmB,GAEzE;EAGF,IAAI,IAAkC;EACtC,KAAK,IAAI,IAAI,IAAQ,GAAG,IAAI,EAAO,SAAS,QAAQ,KAAK;GACvD,IAAM,IAAU,EAAO,SAAS;GAChC,IAAI,EAAQ,SAAS,WAAW;IAC9B,IAAc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IAAS,aAAiB,QAAQ,EAAM,UAAU,OAAO,CAAK;EACpE,MAAU,MAAM,kCAAkC,KAAU,EAAE,OAAO,EAAM,CAAC;CAC9E;AACF"}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../src/plugins/handleCodeTitles.ts","../src/plugins/handleCodeExpandable.ts","../src/plugins/rehypeMermaid.ts","../src/plugins/remarkDirectiveToMdx.ts","../src/mdx-compiler/index.ts","../src/compile.ts","../src/plugins/rehypeCollectTocs.ts","../src/extract.ts"],"sourcesContent":["import type { Node, Parent } from \"unist\";\nimport { visit } from \"unist-util-visit\";\nimport type { ElementNode } from \"../utils\";\n\ninterface TextNode extends Node {\n type: \"text\";\n value: string;\n}\n\nexport const handleCodeTitles = () => (tree: Node) => {\n const toRemove: { parent: Parent; index: number }[] = [];\n\n visit(tree, \"element\", (node: ElementNode, index: number | null, parent: Parent | null) => {\n if (!parent || index === null || node.tagName !== \"div\") {\n return;\n }\n\n const isTitleDiv = node.properties?.className?.includes(\"rehype-code-title\");\n if (!isTitleDiv) {\n return;\n }\n\n let nextElement: ElementNode | null = null;\n for (let i = index + 1; i < parent.children.length; i++) {\n const sibling = parent.children[i];\n if (sibling.type === \"element\") {\n nextElement = sibling as ElementNode;\n break;\n }\n }\n\n if (nextElement?.tagName === \"pre\") {\n const titleNode = node.children?.[0] as TextNode;\n if (titleNode?.type === \"text\") {\n if (!nextElement.properties) {\n nextElement.properties = {};\n }\n nextElement.properties[\"data-title\"] = titleNode.value;\n nextElement.codeTitle = titleNode.value;\n toRemove.push({ parent, index });\n }\n }\n });\n\n // Remove title divs in reverse order to preserve indices\n for (let i = toRemove.length - 1; i >= 0; i--) {\n const { parent, index } = toRemove[i];\n parent.children.splice(index, 1);\n }\n};\n","import type { Node } from \"unist\";\nimport { visit } from \"unist-util-visit\";\nimport type { ElementNode } from \"../utils\";\n\n/**\n * Escape metadata values that are interpolated into MDX-compiled JavaScript.\n *\n * References:\n * - HTML spec (script data state): escape `</` as `\\u003C/` to prevent premature\n * `</script>` closing when the compiled JS is embedded as JSON in a <script> tag.\n * - Bun.escapeHTML(): escapes `< > \" ' &` for HTML context; for JS/JSON context\n * we use `\\uXXXX` JSON Unicode escapes instead so the value survives round-trip\n * through JSON.parse on the client side.\n * - React: JSX auto-escapes attribute values via `{expression}`, so values set\n * as HAST properties (data-language, data-title) are HTML-safe at render time.\n */\nfunction escapeMeta(s: string): string {\n let out = \"\";\n for (let i = 0; i < s.length; i++) {\n const ch = s[i];\n\n // HTML spec: prevent </script> in script/JSON context\n if (ch === \"<\" && s[i + 1] === \"/\") {\n out += \"\\\\u003C/\";\n i++;\n continue;\n }\n\n // JS string: escape template literal & string special chars\n if (ch === \"`\" || ch === \"$\" || ch === \"{\" || ch === \"}\" || ch === '\"' || ch === \"\\\\\") {\n out += `\\\\${ch}`;\n continue;\n }\n\n out += ch;\n }\n return out;\n}\n\ninterface CodeNode extends Node {\n type: \"code\";\n lang?: string;\n meta?: string;\n value: string;\n data?: {\n meta?: string;\n hProperties?: Record<string, unknown>;\n };\n}\n\nfunction countCodeLines(raw: string): number {\n let normalized = raw.replace(/\\r\\n/g, \"\\n\");\n if (normalized.startsWith(\"\\n\")) normalized = normalized.slice(1);\n if (normalized.endsWith(\"\\n\")) normalized = normalized.slice(0, -1);\n\n if (normalized.length === 0) return 0;\n return normalized.split(\"\\n\").length;\n}\n\nexport const handleCodeExpandableRemark = () => (tree: Node) => {\n visit(tree, \"code\", (node: CodeNode) => {\n if (!node.meta) return;\n\n const isExpandable = node.meta.includes(\"Expandable\");\n const [languagePart, titlePart] = (node.lang ?? \"\").split(\":\");\n const normalizedLanguage = languagePart?.trim();\n const normalizedTitle = titlePart?.trim();\n\n if (!isExpandable) return;\n\n const lineCount = countCodeLines(node.value);\n\n if (!node.data) {\n node.data = {};\n }\n if (!node.data.hProperties) {\n node.data.hProperties = {};\n }\n\n node.data.hProperties[\"data-expandable\"] = \"true\";\n node.data.hProperties[\"data-expandable-lines\"] = lineCount.toString();\n\n if (normalizedLanguage) {\n node.data.hProperties[\"data-language\"] = normalizedLanguage;\n }\n if (normalizedTitle) {\n node.data.hProperties[\"data-title\"] = normalizedTitle;\n }\n\n const currentClassName = node.data.hProperties.className;\n const classList = Array.isArray(currentClassName)\n ? currentClassName\n : typeof currentClassName === \"string\"\n ? currentClassName.split(\" \").filter(Boolean)\n : [];\n\n if (!classList.includes(\"mdx-expandable-meta\")) {\n classList.push(\"mdx-expandable-meta\");\n }\n\n node.data.hProperties.className = classList;\n\n if (normalizedLanguage && !node.meta.includes(\"dbLang(\")) {\n node.meta = `${node.meta} dbLang(${escapeMeta(normalizedLanguage)})`.trim();\n }\n if (normalizedTitle && !node.meta.includes(\"dbTitle(\")) {\n node.meta = `${node.meta} dbTitle(${escapeMeta(normalizedTitle)})`.trim();\n }\n });\n};\n\nexport const handleCodeExpandable = () => (tree: Node) => {\n visit(tree, \"element\", (node: ElementNode) => {\n if (node.tagName !== \"pre\") return;\n\n const codeElement = node.children?.find((child) => {\n const element = child as ElementNode;\n return element.type === \"element\" && element.tagName === \"code\";\n }) as ElementNode | undefined;\n\n const codeClassName = codeElement?.properties?.className;\n const codeClassList = Array.isArray(codeClassName)\n ? codeClassName\n : typeof codeClassName === \"string\"\n ? codeClassName.split(\" \").filter(Boolean)\n : [];\n\n const codeMeta =\n codeElement?.data &&\n typeof codeElement.data === \"object\" &&\n typeof codeElement.data[\"meta\"] === \"string\"\n ? (codeElement.data[\"meta\"] as string)\n : undefined;\n\n const languageFromMeta = codeMeta?.match(/dbLang\\(([^)]+)\\)/)?.[1];\n const titleFromMeta = codeMeta?.match(/dbTitle\\(([^)]+)\\)/)?.[1];\n\n const languageFromProps =\n typeof codeElement?.properties?.[\"data-language\"] === \"string\"\n ? (codeElement.properties[\"data-language\"] as string)\n : undefined;\n const titleFromProps =\n typeof codeElement?.properties?.[\"data-title\"] === \"string\"\n ? (codeElement.properties[\"data-title\"] as string)\n : undefined;\n\n const languageFromCodeClass = codeClassList\n .find((item) => item.startsWith(\"language-\"))\n ?.replace(\"language-\", \"\");\n\n const existingPreLanguage =\n typeof node.properties?.[\"data-language\"] === \"string\"\n ? (node.properties[\"data-language\"] as string)\n : undefined;\n const existingPreTitle =\n typeof node.properties?.[\"data-title\"] === \"string\"\n ? (node.properties[\"data-title\"] as string)\n : undefined;\n\n const isExpandable =\n codeElement?.properties?.[\"data-expandable\"] === \"true\" ||\n codeClassList.includes(\"mdx-expandable-meta\") ||\n codeMeta?.includes(\"Expandable\") === true;\n\n const expandableLines = codeElement?.properties?.[\"data-expandable-lines\"];\n if (!isExpandable) return;\n\n if (!node.properties) {\n node.properties = {};\n }\n\n node.properties[\"data-expandable\"] = \"true\";\n if (typeof expandableLines === \"string\" || typeof expandableLines === \"number\") {\n node.properties[\"data-expandable-lines\"] = expandableLines.toString();\n } else if (node.raw) {\n node.properties[\"data-expandable-lines\"] = countCodeLines(node.raw).toString();\n }\n\n const resolvedLanguage =\n languageFromProps ||\n languageFromMeta ||\n languageFromCodeClass ||\n existingPreLanguage ||\n node.language;\n const resolvedTitle = titleFromProps || titleFromMeta || existingPreTitle || node.codeTitle;\n\n if (resolvedLanguage) {\n node.properties[\"data-language\"] = resolvedLanguage;\n }\n if (resolvedTitle) {\n node.properties[\"data-title\"] = resolvedTitle;\n }\n\n const className = node.properties.className;\n if (!className) {\n node.properties.className = [];\n }\n\n if (Array.isArray(node.properties.className)) {\n if (!node.properties.className.includes(\"mdx-expandable-code\")) {\n node.properties.className.push(\"mdx-expandable-code\");\n }\n } else if (typeof className === \"string\") {\n const hasMarker = className.split(\" \").includes(\"mdx-expandable-code\");\n if (!hasMarker) {\n node.properties.className = `${className} mdx-expandable-code`.trim().split(\" \");\n }\n } else {\n node.properties.className = [\"mdx-expandable-code\"];\n }\n\n if (codeElement?.properties) {\n const cleanedCodeClassList = codeClassList.filter((item) => item !== \"mdx-expandable-meta\");\n codeElement.properties.className = cleanedCodeClassList;\n }\n });\n};\n","import type { Node, Parent } from \"unist\";\nimport { visit } from \"unist-util-visit\";\nimport type { ElementNode } from \"../utils\";\n\ninterface TextNode extends Node {\n type: \"text\";\n value: string;\n}\n\n/**\n * Rehype plugin that transforms `<pre><code class=\"language-mermaid\">` fenced\n * blocks into `<Mermaid chart=\"...\">` elements.\n *\n * This allows Mermaid diagram definitions to be authored via standard fenced\n * code blocks (````mermaid) which avoids JSX parsing collisions with\n * Mermaid's `{...}` (decision nodes) and `[...]` (label nodes) syntax.\n */\nexport const rehypeMermaid = () => (tree: Node) => {\n visit(tree, \"element\", (node: ElementNode, index: number | null, parent: Parent | null) => {\n if (!parent || index === null || node.tagName !== \"pre\") return;\n\n const codeEl = node.children?.find(\n (child) =>\n (child as ElementNode).type === \"element\" && (child as ElementNode).tagName === \"code\"\n ) as ElementNode | undefined;\n\n if (!codeEl) return;\n\n const classList = Array.isArray(codeEl.properties?.className)\n ? (codeEl.properties.className as string[])\n : typeof codeEl.properties?.className === \"string\"\n ? (codeEl.properties.className as string).split(\" \").filter(Boolean)\n : [];\n\n if (!classList.includes(\"language-mermaid\")) return;\n\n const textNode = codeEl.children?.find((child) => (child as TextNode).type === \"text\") as\n TextNode | undefined;\n\n const chart = textNode?.value ?? \"\";\n\n parent.children[index] = {\n type: \"element\",\n tagName: \"Mermaid\",\n properties: { chart },\n children: [],\n } as unknown as ElementNode;\n });\n};\n","import type { Node } from \"unist\";\nimport type { VFile } from \"vfile\";\n\n/**\n * Remark plugin: convert markdown directives into MDX component elements.\n *\n * Contract (docubook):\n * - `:::name{attrs} … :::` — container: EVERY component that holds content\n * (tabs, tab, accordions, accordion, steps, step, cards, card, files,\n * folder, note + variants). Children are the block between the opening\n * `:::` and closing `:::` — bounded by micromark's container grammar, so\n * a component can never trap siblings that follow it.\n * - `::name{attrs}` — self-closing leaf (no children): file, youtube,\n * mermaid.\n * - `:tooltip[label]{tip=\"…\"}` — the ONE inline (single-colon) directive.\n * Every other text directive is rebuilt as literal text\n * (`localhost:3000` stays intact). `::tooltip` (block leaf) is removed\n * in v2 — tooltips are inline only.\n *\n * Names are PascalCased to match the components map (`file-tree` → `FileTree`).\n * Bare attributes (`{horizontal}`) become boolean props (JSX bare attribute).\n * Callout variants (`:::tip`, `:::info`, …) map to their own registry entries\n * (`Tip`/`Info`/…) which wrap the `Callout` component with the type set.\n */\nexport function remarkDirectiveToMdx() {\n return (tree: Node, file: VFile) => {\n const source = String(file);\n const root = tree as unknown as { children: Node[] };\n root.children = root.children.map((node) => transform(node, source));\n return tree;\n };\n}\n\n/** Leaves that never hold children (self-closing). */\nconst PURE_LEAVES = new Set([\"youtube\"]);\n\ntype DirectiveNode = Node & {\n type: \"containerDirective\" | \"leafDirective\" | \"textDirective\";\n name: string;\n attributes?: Record<string, string>;\n children?: Node[];\n};\n\nfunction isDirective(node: Node): node is DirectiveNode {\n return (\n node.type === \"containerDirective\" ||\n node.type === \"leafDirective\" ||\n node.type === \"textDirective\"\n );\n}\n\nfunction transform(node: Node, source: string): Node {\n if (!isDirective(node)) {\n const children = (node as unknown as { children?: Node[] }).children;\n if (Array.isArray(children)) {\n (node as unknown as { children: Node[] }).children = children.map((child) =>\n transform(child, source)\n );\n }\n return node;\n }\n if (node.type === \"textDirective\") {\n // `:tooltip[label]{tip=\"…\"}` is the one inline component — it stays\n // inside the paragraph. Every other single-colon text directive is\n // rebuilt as literal text (`localhost:3000` stays intact).\n if (node.name === \"tooltip\") {\n return inlineTooltip(node);\n }\n return literalDirective(node, source);\n }\n // Block-form tooltips are gone in v2 — degrade to literal text so the\n // author sees the directive instead of a broken component.\n if (node.type === \"leafDirective\" && node.name === \"tooltip\") {\n return literalDirective(node, source);\n }\n // containerDirective → component with children; leafDirective → self-closing.\n const children =\n node.type === \"containerDirective\" && !PURE_LEAVES.has(node.name)\n ? (node.children ?? []).map((child) => transform(child, source))\n : [];\n return directiveToElement(node, children);\n}\n\nfunction directiveToElement(directive: DirectiveNode, children: Node[]): Node {\n const name = pascalCase(directive.name);\n const attributes = Object.entries(directive.attributes ?? {}).map(([attrName, value]) => ({\n type: \"mdxJsxAttribute\",\n name: attrName,\n value: value === \"\" ? null : value,\n }));\n return {\n type: \"mdxJsxFlowElement\",\n name,\n attributes,\n children,\n } as Node;\n}\n\n/** Preserve authored syntax: parsed children and attributes lose formatting. */\nfunction literalDirective(directive: DirectiveNode, source: string): Node {\n const start = directive.position?.start.offset;\n const end = directive.position?.end.offset;\n // Synthetic nodes without source offsets cannot be restored losslessly.\n if (start === undefined || end === undefined) return directive;\n return { type: \"text\", value: source.slice(start, end) } as Node;\n}\n\n/**\n * Inline tooltip from a text directive: `:tooltip[label]{tip=\"…\"}`.\n * The label is the visible trigger (dotted underline); `tip` is the hover\n * bubble and defaults to the label, so `:tooltip[text]` alone already shows\n * a bubble. Emits an inline element so it stays inside the paragraph. The\n * bubble auto-positions (no `side` prop).\n */\nfunction inlineTooltip(directive: DirectiveNode): Node {\n const label = (directive.children ?? [])\n .map((child) => (child as { value?: string }).value ?? \"\")\n .join(\"\");\n const attrs = directive.attributes ?? {};\n const attributes = [\n { type: \"mdxJsxAttribute\", name: \"text\", value: attrs.text || label || \"?\" },\n { type: \"mdxJsxAttribute\", name: \"tip\", value: attrs.tip || label || \"\" },\n ];\n return { type: \"mdxJsxTextElement\", name: \"Tooltip\", attributes, children: [] } as Node;\n}\n\nfunction pascalCase(name: string): string {\n return name\n .split(\"-\")\n .map((part) => part.charAt(0).toUpperCase() + part.slice(1))\n .join(\"\");\n}\n","// MPL-2.0 — derived from next-mdx-remote (IBM). See LICENSE-MPL-2.0.\nimport React, { useEffect, useState, useMemo } from \"react\";\nimport * as jsxRuntime from \"react/jsx-runtime\";\nimport * as jsxDevRuntime from \"react/jsx-dev-runtime\";\nimport * as mdx from \"@mdx-js/react\";\nimport type { MDXRemoteSerializeResult } from \"./types.js\";\n\n/** Props for the client-side `<MDXRemote>` (accepts pre-serialized result). */\nexport type MDXRemoteProps = MDXRemoteSerializeResult & {\n components?: Record<string, React.ComponentType<any>>;\n /** Defer hydration to an idle callback */\n lazy?: boolean;\n};\n\n/**\n * Client-side MDX renderer.\n *\n * Accepts a pre-compiled result from `serialize()` and renders it via\n * `MDXProvider` for custom component injection.\n */\nexport function MDXRemote({\n compiledSource,\n frontmatter,\n scope = {},\n components = {},\n lazy,\n}: MDXRemoteProps): React.ReactElement {\n const [ready, setReady] = useState(!lazy || typeof window === \"undefined\");\n\n useEffect(() => {\n if (!lazy) return;\n const id = window.requestIdleCallback\n ? window.requestIdleCallback(() => setReady(true), { timeout: 500 })\n : setTimeout(() => setReady(true), 1);\n return () => {\n if (window.cancelIdleCallback) window.cancelIdleCallback(id as number);\n else clearTimeout(id as number);\n };\n }, [lazy]);\n\n const Content = useMemo(() => {\n // Non-RSC mode: compiled MDX expects `useMDXComponents` (\n // from @mdx-js/react) AND the JSX runtime.\n // In React 19, jsx/jsxs and jsxDEV live in separate modules,\n // so merge both to handle compiled output from any mode.\n const fullScope = {\n opts: { ...mdx, ...jsxRuntime, ...jsxDevRuntime },\n frontmatter,\n ...scope,\n };\n const keys = Object.keys(fullScope);\n const values = Object.values(fullScope);\n const fn = Reflect.construct(Function, keys.concat(`${compiledSource}`));\n return fn.apply(fn, values).default;\n }, [compiledSource, scope, frontmatter]);\n\n if (!ready) {\n return React.createElement(\"div\", {\n dangerouslySetInnerHTML: { __html: \"\" },\n suppressHydrationWarning: true,\n });\n }\n\n const content = React.createElement(\n mdx.MDXProvider,\n { components },\n React.createElement(Content, null)\n );\n\n return lazy ? React.createElement(\"div\", null, content) : content;\n}\n","import { serialize } from \"./mdx-compiler/serialize.js\";\nimport type { Node } from \"unist\";\nimport { visit } from \"unist-util-visit\";\nimport remarkGfm from \"remark-gfm\";\nimport rehypePrism from \"rehype-prism-plus\";\nimport rehypeAutolinkHeadings from \"rehype-autolink-headings\";\nimport rehypeSlug from \"rehype-slug\";\nimport rehypeCodeTitles from \"rehype-code-titles\";\nimport { handleCodeTitles } from \"./plugins/handleCodeTitles\";\nimport { handleCodeExpandableRemark, handleCodeExpandable } from \"./plugins/handleCodeExpandable\";\nimport { rehypeMermaid } from \"./plugins/rehypeMermaid\";\nimport { remarkDirectiveToMdx } from \"./plugins/remarkDirectiveToMdx\";\nimport remarkDirective from \"remark-directive\";\nimport type { ElementNode } from \"./utils\";\nimport type { Pluggable } from \"unified\";\n\n// Re-export serialize for non-RSC usage\nexport { serialize };\n\n// Re-export MDXRemote for client-side hydration\nexport { MDXRemote } from \"./mdx-compiler/index.js\";\n\ninterface TextNode extends Node {\n type: \"text\";\n value: string;\n}\n\nexport const preProcess = () => (tree: Node) => {\n visit(tree, (node: Node) => {\n const element = node as ElementNode;\n if (element?.type === \"element\" && element?.tagName === \"pre\" && element.children) {\n const [codeEl] = element.children as ElementNode[];\n if (codeEl.tagName !== \"code\" || !codeEl.children?.[0]) return;\n\n const className = codeEl.properties?.className;\n const classList = Array.isArray(className)\n ? className\n : typeof className === \"string\"\n ? className.split(\" \").filter(Boolean)\n : [];\n const languageClass = classList.find((item: string) => item.startsWith(\"language-\"));\n if (languageClass) {\n element.language = languageClass.replace(\"language-\", \"\").split(\":\")[0];\n }\n\n const textNode = codeEl.children[0] as TextNode;\n if (textNode.type === \"text\" && textNode.value) {\n element.raw = textNode.value;\n }\n }\n });\n\n return tree;\n};\n\nexport const postProcess = () => (tree: Node) => {\n visit(tree, \"element\", (node: Node) => {\n const element = node as ElementNode;\n if (element?.type === \"element\" && element?.tagName === \"pre\") {\n if (element.properties && element.raw) {\n element.properties.raw = element.raw;\n }\n if (element.properties && element.language && !element.properties[\"data-language\"]) {\n element.properties[\"data-language\"] = element.language;\n }\n if (element.properties && element.codeTitle && !element.properties[\"data-title\"]) {\n element.properties[\"data-title\"] = element.codeTitle;\n }\n }\n });\n\n return tree;\n};\n\nexport function createDefaultRehypePlugins(): Pluggable[] {\n return [\n preProcess,\n rehypeMermaid, // Transform ```mermaid before code transforms\n rehypeCodeTitles,\n handleCodeTitles,\n handleCodeExpandable, // Copy expandable metadata from <code> to <pre> before prism transforms nodes.\n rehypePrism,\n handleCodeExpandable, // Re-apply expandable attrs after prism tokenization.\n rehypeSlug,\n rehypeAutolinkHeadings,\n postProcess,\n ];\n}\n\nexport function createDefaultRemarkPlugins(): Pluggable[] {\n return [remarkGfm, handleCodeExpandableRemark, remarkDirective, remarkDirectiveToMdx];\n}\n","import type { Node } from \"unist\";\nimport { visit } from \"unist-util-visit\";\nimport type { TocItem } from \"../types\";\nimport type { ElementNode } from \"../utils\";\n\nfunction headingText(node: Node): string {\n const element = node as ElementNode;\n if (element.properties?.ariaHidden === true || element.properties?.ariaHidden === \"true\") {\n return \"\";\n }\n if (node.type === \"text\") return (node as Node & { value: string }).value;\n return element.children?.map(headingText).join(\"\") ?? \"\";\n}\n\n/** Collect final heading IDs, after slugging and user rehype transforms. */\nexport function rehypeCollectTocs(tocs: TocItem[]) {\n return (tree: Node) => {\n tocs.length = 0;\n visit(tree, \"element\", (node: ElementNode) => {\n if (!/^h[2-4]$/.test(node.tagName ?? \"\") || typeof node.properties?.id !== \"string\") return;\n tocs.push({\n level: Number(node.tagName!.slice(1)),\n text: headingText(node),\n href: `#${node.properties.id}`,\n });\n });\n };\n}\n","import matter from \"@11ty/gray-matter\";\nimport type { ZodType } from \"zod\";\nimport type { TocItem } from \"./types\";\nimport { compileSync } from \"@mdx-js/mdx\";\nimport { createDefaultRemarkPlugins } from \"./compile\";\nimport rehypeSlug from \"rehype-slug\";\nimport { rehypeCollectTocs } from \"./plugins/rehypeCollectTocs\";\n\nexport function sluggify(text: string): string {\n const normalized = text.normalize(\"NFD\").replace(/[\\u0300-\\u036f]/g, \"\"); // Remove accents\n const slug = normalized.toLowerCase().replace(/\\s+/g, \"-\");\n return slug.replace(/[^a-z0-9-]/g, \"\");\n}\n\nexport function extractTocsFromRawMdx(rawMdx: string): TocItem[] {\n const tocs: TocItem[] = [];\n compileSync(matter(rawMdx).content, {\n format: \"md\",\n remarkPlugins: createDefaultRemarkPlugins(),\n rehypePlugins: [rehypeSlug, [rehypeCollectTocs, tocs]],\n });\n return tocs;\n}\n\nexport function extractFrontmatter<Frontmatter>(content: string): Frontmatter {\n try {\n return matter(content).data as Frontmatter;\n } catch (error) {\n const reason = error instanceof Error ? error.message : String(error);\n throw new Error(`Failed to extract frontmatter: ${reason}`, { cause: error });\n }\n}\n\n/**\n * Extract frontmatter and return both the parsed data and the content\n * with the frontmatter block stripped. Avoids a second parse during\n * compilation.\n *\n * Optionally validates the parsed frontmatter with a Zod schema.\n * YAML coerces unquoted values (e.g. `date: 2026-06-10` → Date, `3.5` → number),\n * so use `z.coerce.*` for fields that must remain strings.\n */\nexport function extractFrontmatterWithContent<Frontmatter>(content: string): {\n frontmatter: Frontmatter;\n strippedContent: string;\n};\nexport function extractFrontmatterWithContent<Frontmatter>(\n content: string,\n schema: ZodType<Frontmatter>\n): { frontmatter: Frontmatter; strippedContent: string };\nexport function extractFrontmatterWithContent<Frontmatter>(\n content: string,\n schema?: ZodType<Frontmatter>\n): { frontmatter: Frontmatter; strippedContent: string } {\n try {\n const { data, content: strippedContent } = matter(content);\n return {\n frontmatter: schema ? schema.parse(data) : (data as Frontmatter),\n strippedContent,\n };\n } catch (error) {\n const reason = error instanceof Error ? error.message : String(error);\n throw new Error(`Failed to extract frontmatter: ${reason}`, { cause: error });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AASA,IAAa,WAA0B,MAAe;CACpD,IAAM,IAAgD,CAAC;CAEvD,EAAM,GAAM,YAAY,GAAmB,GAAsB,MAA0B;EAMzF,IALI,CAAC,KAAU,MAAU,QAAQ,EAAK,YAAY,SAK9C,CADe,EAAK,YAAY,WAAW,SAAS,mBAAmB,GAEzE;EAGF,IAAI,IAAkC;EACtC,KAAK,IAAI,IAAI,IAAQ,GAAG,IAAI,EAAO,SAAS,QAAQ,KAAK;GACvD,IAAM,IAAU,EAAO,SAAS;GAChC,IAAI,EAAQ,SAAS,WAAW;IAC9B,IAAc;IACd;GACF;EACF;EAEA,IAAI,GAAa,YAAY,OAAO;GAClC,IAAM,IAAY,EAAK,WA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O;EACd,IAAM,IAAS,aAAiB,QAAQ,EAAM,UAAU,OAAO,CAAK;EACpE,MAAU,MAAM,kCAAkC,KAAU,EAAE,OAAO,EAAM,CAAC;CAC9E;AACF"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Node } from "unist";
|
|
2
|
+
import type { VFile } from "vfile";
|
|
2
3
|
/**
|
|
3
4
|
* Remark plugin: convert markdown directives into MDX component elements.
|
|
4
5
|
*
|
|
@@ -20,4 +21,4 @@ import type { Node } from "unist";
|
|
|
20
21
|
* Callout variants (`:::tip`, `:::info`, …) map to their own registry entries
|
|
21
22
|
* (`Tip`/`Info`/…) which wrap the `Callout` component with the type set.
|
|
22
23
|
*/
|
|
23
|
-
export declare function remarkDirectiveToMdx(): (tree: Node) => Node;
|
|
24
|
+
export declare function remarkDirectiveToMdx(): (tree: Node, file: VFile) => Node;
|