@dogsbay/format-mdx 0.2.0-beta.0

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/dist/cli.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ import type { FormatPlugin } from "@dogsbay/types";
2
+ export declare const plugin: FormatPlugin;
3
+ //# sourceMappingURL=cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAuB,MAAM,gBAAgB,CAAC;AAmIxE,eAAO,MAAM,MAAM,EAAE,YAQpB,CAAC"}
package/dist/cli.js ADDED
@@ -0,0 +1,117 @@
1
+ import { existsSync, readFileSync, readdirSync, statSync } from "node:fs";
2
+ import { join, relative } from "node:path";
3
+ import YAML from "yaml";
4
+ import { parseMeta } from "@dogsbay/types";
5
+ import { mdxToTree, extractHeadings } from "./parse.js";
6
+ /**
7
+ * Detect a pulled MDX docs directory.
8
+ *
9
+ * Looks for nav.json (written by `dogsbay pull`) + at least one .md file.
10
+ */
11
+ function detectMdxDir(path) {
12
+ return (existsSync(join(path, "nav.json")) &&
13
+ existsSync(path) &&
14
+ hasMdFiles(path));
15
+ }
16
+ function hasMdFiles(dir) {
17
+ try {
18
+ const entries = readdirSync(dir);
19
+ return entries.some((e) => e.endsWith(".md") && e !== "llms.txt");
20
+ }
21
+ catch {
22
+ return false;
23
+ }
24
+ }
25
+ /**
26
+ * Import a directory of pulled MDX files into ExportPage[] + NavItem[].
27
+ */
28
+ async function importMdxDir(source, opts) {
29
+ // Read nav.json
30
+ const navPath = join(source, "nav.json");
31
+ const nav = JSON.parse(readFileSync(navPath, "utf-8"));
32
+ // Walk all .md files
33
+ const mdFiles = walkMdFiles(source, source);
34
+ const pages = [];
35
+ // Custom taxonomy names from dogsbay.config.yml's `taxonomies:` block.
36
+ const taxonomyNames = Array.isArray(opts.taxonomyNames)
37
+ ? opts.taxonomyNames
38
+ : undefined;
39
+ for (const { filePath, slug } of mdFiles) {
40
+ const content = readFileSync(filePath, "utf-8");
41
+ const frontmatter = extractFrontmatter(content);
42
+ const tree = mdxToTree(content);
43
+ const headings = extractHeadings(tree);
44
+ // Extract title: prefer frontmatter, fall back to first h1
45
+ const titleNode = tree.find((n) => n.type === "heading" && n.props?.level === 1);
46
+ const title = (typeof frontmatter?.title === "string" ? frontmatter.title : undefined) ??
47
+ titleNode?.props?.text ??
48
+ "";
49
+ const meta = parseMeta(frontmatter, { slug, taxonomyNames });
50
+ pages.push({ slug, title, tree, headings, frontmatter, meta });
51
+ }
52
+ // Attach metadata for exporters to consume
53
+ const llmsTxtPath = join(source, "llms.txt");
54
+ if (existsSync(llmsTxtPath)) {
55
+ const llmsContent = readFileSync(llmsTxtPath, "utf-8");
56
+ const titleMatch = llmsContent.match(/^#\s+(.+)$/m);
57
+ if (titleMatch) {
58
+ opts.siteName = opts.siteName || titleMatch[1].trim();
59
+ }
60
+ }
61
+ return { pages, nav };
62
+ }
63
+ const FRONTMATTER_RE = /^---\n([\s\S]*?)\n---\n?/;
64
+ /**
65
+ * Lift YAML frontmatter from the raw markdown source. Returns
66
+ * `undefined` when the source has no frontmatter or the YAML doesn't
67
+ * parse to a plain object. Tolerates malformed YAML quietly.
68
+ */
69
+ function extractFrontmatter(source) {
70
+ const match = FRONTMATTER_RE.exec(source);
71
+ if (!match)
72
+ return undefined;
73
+ const raw = match[1];
74
+ if (raw.trim().length === 0)
75
+ return undefined;
76
+ try {
77
+ const parsed = YAML.parse(raw);
78
+ if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
79
+ return parsed;
80
+ }
81
+ return undefined;
82
+ }
83
+ catch {
84
+ return undefined;
85
+ }
86
+ }
87
+ /**
88
+ * Recursively find all .md files in a directory.
89
+ * Returns slug (relative path without .md) and absolute file path.
90
+ */
91
+ function walkMdFiles(dir, root) {
92
+ const results = [];
93
+ const entries = readdirSync(dir);
94
+ for (const entry of entries) {
95
+ const fullPath = join(dir, entry);
96
+ const stat = statSync(fullPath);
97
+ if (stat.isDirectory()) {
98
+ results.push(...walkMdFiles(fullPath, root));
99
+ }
100
+ else if (entry.endsWith(".md") && entry !== "llms.txt") {
101
+ const rel = relative(root, fullPath);
102
+ const slug = rel.replace(/\.md$/, "").replace(/\\/g, "/");
103
+ results.push({ filePath: fullPath, slug });
104
+ }
105
+ }
106
+ return results;
107
+ }
108
+ export const plugin = {
109
+ name: "mdx",
110
+ canImport: true,
111
+ canExport: false,
112
+ detectSource: detectMdxDir,
113
+ importOptions: [],
114
+ exportOptions: [],
115
+ import: importMdxDir,
116
+ };
117
+ //# sourceMappingURL=cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC1E,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAY,MAAM,WAAW,CAAC;AACrD,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAExD;;;;GAIG;AACH,SAAS,YAAY,CAAC,IAAY;IAChC,OAAO,CACL,UAAU,CAAC,IAAI,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;QAClC,UAAU,CAAC,IAAI,CAAC;QAChB,UAAU,CAAC,IAAI,CAAC,CACjB,CAAC;AACJ,CAAC;AAED,SAAS,UAAU,CAAC,GAAW;IAC7B,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC;QACjC,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK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AE,EAAE;IACjB,aAAa,EAAE,EAAE;IACjB,MAAM,EAAE,YAAY;CACrB,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { mdxToTree, extractHeadings } from "./parse.js";
2
+ export type { TreeNode, InlineNode, ExportPage, NavItem } from "@dogsbay/types";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AACxD,YAAY,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
1
+ export { mdxToTree, extractHeadings } from "./parse.js";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC"}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * MDX parser — parse MDX/markdown with JSX component syntax into TreeNode[].
3
+ *
4
+ * Strategy: line-by-line state machine.
5
+ * 1. Track fenced code blocks (``` or ~~~) — content inside is literal, not parsed.
6
+ * 2. Detect JSX component tags (<Tabs>, <Step>, <Info>, etc.)
7
+ * 3. Collect standard markdown between components.
8
+ * 4. Parse markdown sections with markdown-it for inline formatting.
9
+ * 5. Map components to TreeNode types.
10
+ *
11
+ * The MDX served by Mintlify/Next.js uses well-formed, XML-like JSX tags with
12
+ * string attributes — no complex JSX expressions. This means a simple recursive
13
+ * tag parser works without a full JSX/AST parser.
14
+ */
15
+ import type { TreeNode } from "@dogsbay/types";
16
+ export declare function mdxToTree(source: string): TreeNode[];
17
+ interface Heading {
18
+ depth: number;
19
+ slug: string;
20
+ text: string;
21
+ }
22
+ /**
23
+ * Extract headings from a TreeNode[] tree for table of contents.
24
+ * Also ensures each heading node has slug and text props.
25
+ */
26
+ export declare function extractHeadings(nodes: TreeNode[]): Heading[];
27
+ export {};
28
+ //# sourceMappingURL=parse.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../src/parse.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAIH,OAAO,KAAK,EAAE,QAAQ,EAAc,MAAM,gBAAgB,CAAC;AAmF3D,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,QAAQ,EAAE,CAkBpD;AA0nBD,UAAU,OAAO;IACf,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,QAAQ,EAAE,GAAG,OAAO,EAAE,CA6B5D"}
package/dist/parse.js ADDED
@@ -0,0 +1,660 @@
1
+ /**
2
+ * MDX parser — parse MDX/markdown with JSX component syntax into TreeNode[].
3
+ *
4
+ * Strategy: line-by-line state machine.
5
+ * 1. Track fenced code blocks (``` or ~~~) — content inside is literal, not parsed.
6
+ * 2. Detect JSX component tags (<Tabs>, <Step>, <Info>, etc.)
7
+ * 3. Collect standard markdown between components.
8
+ * 4. Parse markdown sections with markdown-it for inline formatting.
9
+ * 5. Map components to TreeNode types.
10
+ *
11
+ * The MDX served by Mintlify/Next.js uses well-formed, XML-like JSX tags with
12
+ * string attributes — no complex JSX expressions. This means a simple recursive
13
+ * tag parser works without a full JSX/AST parser.
14
+ */
15
+ import MarkdownIt from "markdown-it";
16
+ const md = new MarkdownIt({ html: true, linkify: true });
17
+ const COMPONENT_MAP = {
18
+ // Callouts — map to native Obsidian callout syntax
19
+ Info: { type: "callout", container: true, propsFromAttrs: () => ({ variant: "info" }) },
20
+ Tip: { type: "callout", container: true, propsFromAttrs: () => ({ variant: "tip" }) },
21
+ Warning: { type: "callout", container: true, propsFromAttrs: () => ({ variant: "warning" }) },
22
+ Note: { type: "callout", container: true, propsFromAttrs: () => ({ variant: "note" }) },
23
+ Danger: { type: "callout", container: true, propsFromAttrs: () => ({ variant: "danger" }) },
24
+ Callout: {
25
+ type: "callout", container: true,
26
+ propsFromAttrs: (attrs) => ({ variant: attrs.type || "note", title: attrs.title }),
27
+ },
28
+ // Tabs
29
+ Tabs: { type: "tabs", container: true },
30
+ Tab: {
31
+ type: "tab", container: true,
32
+ propsFromAttrs: (attrs) => ({ title: attrs.title || attrs.label || "" }),
33
+ },
34
+ CodeGroup: { type: "tabs", container: true },
35
+ // Steps
36
+ Steps: { type: "steps", container: true },
37
+ Step: {
38
+ type: "step", container: true,
39
+ propsFromAttrs: (attrs) => ({ title: attrs.title || "" }),
40
+ },
41
+ // Accordion
42
+ AccordionGroup: { type: "accordion-group", container: true },
43
+ Accordion: {
44
+ type: "details", container: true,
45
+ propsFromAttrs: (attrs) => ({
46
+ title: attrs.title || "",
47
+ icon: attrs.icon,
48
+ variant: "note",
49
+ }),
50
+ },
51
+ // Cards
52
+ CardGroup: { type: "cards", container: true },
53
+ Card: {
54
+ type: "card", container: true,
55
+ propsFromAttrs: (attrs) => ({
56
+ title: attrs.title || "",
57
+ icon: attrs.icon,
58
+ href: attrs.href,
59
+ }),
60
+ },
61
+ // Frame (image wrapper with optional caption)
62
+ Frame: {
63
+ type: "figure", container: true,
64
+ propsFromAttrs: (attrs) => ({ caption: attrs.caption }),
65
+ },
66
+ // Strip these — LLM-specific preambles or site-specific interactive widgets
67
+ AgentInstructions: { type: "", container: true, strip: true },
68
+ Experiment: { type: "", container: true, strip: true },
69
+ ContactSalesCard: { type: "", container: true, strip: true },
70
+ InstallConfigurator: { type: "", container: true, strip: true },
71
+ };
72
+ // Tags we recognize as self-closing (no children)
73
+ const SELF_CLOSING_TAGS = new Set(["Frame", "ContactSalesCard"]);
74
+ // ── Main parser ──────────────────────────────────────────
75
+ export function mdxToTree(source) {
76
+ // Strip LLM preamble (blockquote at top referencing llms.txt)
77
+ let cleaned = stripPreamble(source);
78
+ // Strip JSX component definitions (export const Foo = () => { ... };)
79
+ // These are React components embedded in MDX that can't be converted
80
+ cleaned = stripJsxExports(cleaned);
81
+ // Parse into a flat list of segments: markdown blocks and component blocks
82
+ const segments = segmentMdx(cleaned);
83
+ // Convert segments to TreeNode[]
84
+ const tree = segmentsToTree(segments);
85
+ // Post-process: rewrite links, fix JSX attributes, handle dark mode images
86
+ postProcess(tree);
87
+ return tree;
88
+ }
89
+ // ── Post-processing ──────────────────────────────────────
90
+ /**
91
+ * Walk the tree and fix HTML content:
92
+ * - Rewrite internal links: /en/foo → /docs/foo
93
+ * - Convert JSX className to HTML class
94
+ * - Handle dark mode images (className="hidden dark:block" → hide by default)
95
+ */
96
+ function postProcess(nodes) {
97
+ for (const node of nodes) {
98
+ // Fix HTML strings
99
+ if (node.html) {
100
+ node.html = fixHtml(node.html);
101
+ }
102
+ // Fix href props (cards, links, etc.)
103
+ if (node.props?.href && typeof node.props.href === "string") {
104
+ node.props.href = node.props.href.replace(/^\/en\//, "/docs/");
105
+ }
106
+ // Handle figure nodes (from <Frame>) — process children HTML
107
+ if (node.type === "figure" && node.children) {
108
+ // Filter out dark-only images, keep light/default ones
109
+ filterDarkModeImages(node);
110
+ }
111
+ if (node.children)
112
+ postProcess(node.children);
113
+ }
114
+ }
115
+ function fixHtml(html) {
116
+ // Rewrite internal links: /en/foo#bar → /docs/foo#bar
117
+ html = html.replace(/href="\/en\//g, 'href="/docs/');
118
+ // Convert JSX className to HTML class
119
+ html = html.replace(/className="/g, 'class="');
120
+ return html;
121
+ }
122
+ /**
123
+ * Handle <Frame> children with light/dark image variants.
124
+ * Keep only the light variant (class="dark:hidden") or default.
125
+ * Strip the dark-only variant (class="hidden dark:block").
126
+ */
127
+ function filterDarkModeImages(node) {
128
+ if (!node.children)
129
+ return;
130
+ node.children = node.children.filter((child) => {
131
+ if (child.html) {
132
+ // Fix className first
133
+ child.html = fixHtml(child.html);
134
+ // Drop images that are hidden by default (dark-only variants)
135
+ if (child.html.includes('class="hidden dark:block"')) {
136
+ return false;
137
+ }
138
+ // Remove the "dark:hidden" class from light variants (just show them always)
139
+ child.html = child.html.replace(' class="dark:hidden"', '');
140
+ }
141
+ return true;
142
+ });
143
+ }
144
+ // ── Preamble stripping ───────────────────────────────────
145
+ function stripPreamble(source) {
146
+ const lines = source.split("\n");
147
+ let start = 0;
148
+ // Strip YAML frontmatter (--- ... ---)
149
+ if (lines[start]?.trim() === "---") {
150
+ start++;
151
+ while (start < lines.length && lines[start]?.trim() !== "---") {
152
+ start++;
153
+ }
154
+ if (start < lines.length)
155
+ start++; // skip closing ---
156
+ while (start < lines.length && lines[start]?.trim() === "") {
157
+ start++;
158
+ }
159
+ }
160
+ // Skip leading blockquote lines (the llms.txt reference / Mintlify preamble)
161
+ while (start < lines.length && lines[start].startsWith(">")) {
162
+ start++;
163
+ }
164
+ // Skip blank line after blockquote
165
+ while (start < lines.length && lines[start].trim() === "") {
166
+ start++;
167
+ }
168
+ let content = lines.slice(start).join("\n");
169
+ // Strip Cloudflare/Starlight preamble: navigation links, feedback, edit links
170
+ content = content.replace(/^\[Skip to content\]\([^)]*\)\s*\n*/m, "");
171
+ content = content.replace(/^Was this helpful\?\s*\n*/m, "");
172
+ content = content.replace(/^YesNo\s*\n*/m, "");
173
+ content = content.replace(/^\[\s*Edit page\s*\]\([^)]*\)\s*\[\s*Report issue\s*\]\([^)]*\)\s*\n*/m, "");
174
+ content = content.replace(/^Copy page\s*\n*/m, "");
175
+ // Strip trailing JSON-LD breadcrumb (Schema.org)
176
+ content = content.replace(/\n```json\n\{"@context":"https:\/\/schema\.org"[\s\S]*$/, "");
177
+ return content.trim();
178
+ }
179
+ /**
180
+ * Strip `export const Foo = () => { ... };` blocks from MDX source.
181
+ *
182
+ * These are React component definitions embedded in MDX that can't be
183
+ * converted to static markup. They appear as bare JavaScript in the
184
+ * markdown and would otherwise render as visible source code.
185
+ *
186
+ * Uses brace-depth tracking to find the end of each export block.
187
+ */
188
+ function stripJsxExports(source) {
189
+ const lines = source.split("\n");
190
+ const result = [];
191
+ let i = 0;
192
+ while (i < lines.length) {
193
+ const line = lines[i];
194
+ // Detect export const ... = () => { or export const ... = ({ ... }) => {
195
+ if (line.match(/^export\s+const\s+\w+\s*=/)) {
196
+ // Skip this entire block by tracking brace depth
197
+ let depth = 0;
198
+ let started = false;
199
+ while (i < lines.length) {
200
+ for (const ch of lines[i]) {
201
+ if (ch === "{") {
202
+ depth++;
203
+ started = true;
204
+ }
205
+ if (ch === "}")
206
+ depth--;
207
+ }
208
+ i++;
209
+ // End when we've seen at least one { and depth returns to 0
210
+ if (started && depth <= 0)
211
+ break;
212
+ }
213
+ // Also skip trailing semicolons or blank lines
214
+ while (i < lines.length && (lines[i].trim() === ";" || lines[i].trim() === "")) {
215
+ i++;
216
+ }
217
+ continue;
218
+ }
219
+ result.push(line);
220
+ i++;
221
+ }
222
+ return result.join("\n");
223
+ }
224
+ /**
225
+ * Split MDX source into alternating markdown and component segments.
226
+ * Handles nested components, fenced code blocks, and self-closing tags.
227
+ */
228
+ function segmentMdx(source) {
229
+ const segments = [];
230
+ const lines = source.split("\n");
231
+ let i = 0;
232
+ let markdownBuffer = [];
233
+ function flushMarkdown() {
234
+ const content = markdownBuffer.join("\n").trim();
235
+ if (content) {
236
+ segments.push({ kind: "markdown", content });
237
+ }
238
+ markdownBuffer = [];
239
+ }
240
+ while (i < lines.length) {
241
+ const line = lines[i];
242
+ const trimmed = line.trim();
243
+ // Check for single-line component: <Tag>content</Tag> on one line
244
+ const singleLineMatch = trimmed.match(/^<([A-Z]\w*)(\s[^>]*)?>(.+)<\/\1>$/);
245
+ if (singleLineMatch && COMPONENT_MAP[singleLineMatch[1]]) {
246
+ flushMarkdown();
247
+ const tag = singleLineMatch[1];
248
+ const attrStr = singleLineMatch[2] || "";
249
+ const children = singleLineMatch[3];
250
+ segments.push({
251
+ kind: "component",
252
+ tag,
253
+ attrs: parseAttrs(attrStr),
254
+ children,
255
+ selfClosing: false,
256
+ });
257
+ i++;
258
+ continue;
259
+ }
260
+ // Check for component opening tag at the start of a line
261
+ const openMatch = trimmed.match(/^<([A-Z]\w*)(\s[^>]*)?\s*\/?>$/);
262
+ if (openMatch) {
263
+ const tag = openMatch[1];
264
+ const attrStr = openMatch[2] || "";
265
+ const isSelfClose = trimmed.endsWith("/>");
266
+ if (COMPONENT_MAP[tag]) {
267
+ flushMarkdown();
268
+ if (isSelfClose) {
269
+ segments.push({
270
+ kind: "component",
271
+ tag,
272
+ attrs: parseAttrs(attrStr),
273
+ children: "",
274
+ selfClosing: true,
275
+ });
276
+ i++;
277
+ continue;
278
+ }
279
+ // Collect children until closing tag
280
+ const { content, endLine } = collectUntilClose(lines, i + 1, tag);
281
+ segments.push({
282
+ kind: "component",
283
+ tag,
284
+ attrs: parseAttrs(attrStr),
285
+ children: content,
286
+ selfClosing: false,
287
+ });
288
+ i = endLine + 1;
289
+ continue;
290
+ }
291
+ }
292
+ // Also check for opening tags that aren't on their own line (with content after)
293
+ const inlineOpenMatch = trimmed.match(/^<([A-Z]\w*)(\s[^>]*)?>$/);
294
+ if (inlineOpenMatch && !openMatch) {
295
+ const tag = inlineOpenMatch[1];
296
+ const attrStr = inlineOpenMatch[2] || "";
297
+ if (COMPONENT_MAP[tag]) {
298
+ flushMarkdown();
299
+ const { content, endLine } = collectUntilClose(lines, i + 1, tag);
300
+ segments.push({
301
+ kind: "component",
302
+ tag,
303
+ attrs: parseAttrs(attrStr),
304
+ children: content,
305
+ selfClosing: false,
306
+ });
307
+ i = endLine + 1;
308
+ continue;
309
+ }
310
+ }
311
+ markdownBuffer.push(line);
312
+ i++;
313
+ }
314
+ flushMarkdown();
315
+ return segments;
316
+ }
317
+ /**
318
+ * Collect lines until the matching closing tag, handling nesting.
319
+ * Respects fenced code blocks (content inside is literal).
320
+ */
321
+ function collectUntilClose(lines, startLine, tag) {
322
+ let depth = 1;
323
+ let i = startLine;
324
+ const collected = [];
325
+ let inFence = false;
326
+ let fenceChar = "";
327
+ while (i < lines.length) {
328
+ const line = lines[i];
329
+ const trimmed = line.trim();
330
+ // Track fenced code blocks — don't parse tags inside them
331
+ if (!inFence) {
332
+ const fenceMatch = trimmed.match(/^(`{3,}|~{3,})/);
333
+ if (fenceMatch) {
334
+ inFence = true;
335
+ fenceChar = fenceMatch[1][0];
336
+ }
337
+ }
338
+ else {
339
+ if (trimmed.match(new RegExp(`^${fenceChar.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}{3,}$`))) {
340
+ inFence = false;
341
+ }
342
+ collected.push(line);
343
+ i++;
344
+ continue;
345
+ }
346
+ // Check for nested opening/closing of the same tag
347
+ const closeMatch = trimmed.match(new RegExp(`^</${tag}\\s*>$`));
348
+ if (closeMatch) {
349
+ depth--;
350
+ if (depth === 0) {
351
+ return { content: dedent(collected.join("\n")), endLine: i };
352
+ }
353
+ }
354
+ const openMatch = trimmed.match(new RegExp(`^<${tag}(\\s[^>]*)?>$`));
355
+ if (openMatch && !trimmed.endsWith("/>")) {
356
+ depth++;
357
+ }
358
+ collected.push(line);
359
+ i++;
360
+ }
361
+ // If we never found the closing tag, return everything
362
+ return { content: dedent(collected.join("\n")), endLine: lines.length - 1 };
363
+ }
364
+ /**
365
+ * Remove common leading whitespace from all lines.
366
+ * MDX component children are typically indented to match the tag nesting.
367
+ * This indentation must be removed before parsing as markdown, otherwise
368
+ * 4-space indented lines are treated as code blocks (CommonMark spec).
369
+ */
370
+ function dedent(text) {
371
+ const lines = text.split("\n");
372
+ // Find minimum indentation of non-empty lines
373
+ let minIndent = Infinity;
374
+ for (const line of lines) {
375
+ if (line.trim() === "")
376
+ continue;
377
+ const indent = line.match(/^(\s*)/)?.[1].length ?? 0;
378
+ if (indent < minIndent)
379
+ minIndent = indent;
380
+ }
381
+ if (minIndent === 0 || minIndent === Infinity)
382
+ return text;
383
+ return lines.map((line) => line.slice(minIndent)).join("\n");
384
+ }
385
+ // ── Attribute parsing ────────────────────────────────────
386
+ function parseAttrs(attrStr) {
387
+ const attrs = {};
388
+ // Match: key="value" or key={value} or key='value'
389
+ const re = /(\w+)\s*=\s*(?:"([^"]*)"|'([^']*)'|\{([^}]*)\})/g;
390
+ let match;
391
+ while ((match = re.exec(attrStr))) {
392
+ attrs[match[1]] = match[2] ?? match[3] ?? match[4] ?? "";
393
+ }
394
+ return attrs;
395
+ }
396
+ // ── Segments → TreeNode[] ────────────────────────────────
397
+ function segmentsToTree(segments) {
398
+ const nodes = [];
399
+ for (const seg of segments) {
400
+ if (seg.kind === "markdown") {
401
+ nodes.push(...markdownToNodes(seg.content));
402
+ }
403
+ else {
404
+ const mapping = COMPONENT_MAP[seg.tag];
405
+ if (!mapping || mapping.strip)
406
+ continue;
407
+ const node = componentToNode(seg, mapping);
408
+ if (node)
409
+ nodes.push(node);
410
+ }
411
+ }
412
+ return nodes;
413
+ }
414
+ function componentToNode(seg, mapping) {
415
+ const props = mapping.propsFromAttrs
416
+ ? mapping.propsFromAttrs(seg.attrs)
417
+ : {};
418
+ // Special handling for tabs container
419
+ if (mapping.type === "tabs") {
420
+ return tabsToNode(seg);
421
+ }
422
+ // Special handling for steps container
423
+ if (mapping.type === "steps") {
424
+ return stepsToNode(seg);
425
+ }
426
+ // Special handling for accordion-group
427
+ if (mapping.type === "accordion-group") {
428
+ // Parse children as segments, extract accordion items
429
+ const childSegments = segmentMdx(seg.children);
430
+ const children = segmentsToTree(childSegments);
431
+ return { type: "accordion-group", children };
432
+ }
433
+ // Special handling for cards container
434
+ if (mapping.type === "cards") {
435
+ const childSegments = segmentMdx(seg.children);
436
+ const children = segmentsToTree(childSegments);
437
+ return { type: "cards", children };
438
+ }
439
+ // For callouts, details, card — parse children as content
440
+ const children = seg.selfClosing ? [] : mdxToTree(seg.children);
441
+ const node = { type: mapping.type };
442
+ if (Object.keys(props).length > 0)
443
+ node.props = props;
444
+ if (children.length > 0)
445
+ node.children = children;
446
+ // For callout types, if there's a title prop, set it
447
+ if (mapping.type === "callout" && props.title) {
448
+ node.props = { ...props };
449
+ }
450
+ return node;
451
+ }
452
+ // ── Tabs handling ────────────────────────────────────────
453
+ function tabsToNode(seg) {
454
+ // Parse children to find <Tab> segments
455
+ const childSegments = segmentMdx(seg.children);
456
+ const tabs = [];
457
+ for (const child of childSegments) {
458
+ if (child.kind === "component" && child.tag === "Tab") {
459
+ const title = child.attrs.title || child.attrs.label || "";
460
+ const content = mdxToTree(child.children);
461
+ tabs.push({
462
+ type: "tab",
463
+ props: { title },
464
+ children: content,
465
+ });
466
+ }
467
+ // Ignore non-Tab children inside Tabs
468
+ }
469
+ return { type: "tabs", children: tabs };
470
+ }
471
+ // ── Steps handling ───────────────────────────────────────
472
+ function stepsToNode(seg) {
473
+ const childSegments = segmentMdx(seg.children);
474
+ const steps = [];
475
+ for (const child of childSegments) {
476
+ if (child.kind === "component" && child.tag === "Step") {
477
+ const title = child.attrs.title || "";
478
+ const content = mdxToTree(child.children);
479
+ // Prepend title as bold text if present
480
+ const children = [];
481
+ if (title) {
482
+ children.push({ type: "prose", html: `<strong>${title}</strong>` });
483
+ }
484
+ children.push(...content);
485
+ steps.push({
486
+ type: "step",
487
+ props: { title },
488
+ children,
489
+ });
490
+ }
491
+ }
492
+ return { type: "steps", children: steps };
493
+ }
494
+ // ── Markdown → TreeNode[] ────────────────────────────────
495
+ /**
496
+ * Parse a block of standard markdown (no component tags) into TreeNode[].
497
+ *
498
+ * Uses markdown-it for tokenization, then walks tokens to build TreeNode[].
499
+ */
500
+ function markdownToNodes(content) {
501
+ const tokens = md.parse(content, {});
502
+ return tokensToTree(tokens);
503
+ }
504
+ function tokensToTree(tokens) {
505
+ const nodes = [];
506
+ let i = 0;
507
+ while (i < tokens.length) {
508
+ const token = tokens[i];
509
+ // Handle open/close container tokens generically
510
+ if (token.nesting === 1) {
511
+ const closeTag = token.type.replace("_open", "_close");
512
+ const children = [];
513
+ i++;
514
+ let depth = 1;
515
+ while (i < tokens.length && depth > 0) {
516
+ if (tokens[i].type === token.type)
517
+ depth++;
518
+ if (tokens[i].type === closeTag) {
519
+ depth--;
520
+ if (depth === 0)
521
+ break;
522
+ }
523
+ children.push(tokens[i]);
524
+ i++;
525
+ }
526
+ i++; // skip close token
527
+ const node = openTokenToNode(token, children);
528
+ if (node)
529
+ nodes.push(node);
530
+ continue;
531
+ }
532
+ // Handle flat (self-closing) tokens
533
+ switch (token.type) {
534
+ case "fence": {
535
+ const lang = token.info?.split(/\s+/)[0] || "";
536
+ const code = token.content.replace(/\n$/, "");
537
+ nodes.push({
538
+ type: "code",
539
+ props: { lang: lang || null, code },
540
+ });
541
+ i++;
542
+ break;
543
+ }
544
+ case "inline": {
545
+ // Standalone inline (e.g., inside a heading or paragraph container)
546
+ const html = md.renderInline(token.content);
547
+ nodes.push({ type: "prose", html });
548
+ i++;
549
+ break;
550
+ }
551
+ case "hr": {
552
+ nodes.push({ type: "hr" });
553
+ i++;
554
+ break;
555
+ }
556
+ case "html_block": {
557
+ const trimmed = token.content.trim();
558
+ if (!trimmed.match(/^<[A-Z]/)) {
559
+ nodes.push({ type: "html", html: token.content });
560
+ }
561
+ i++;
562
+ break;
563
+ }
564
+ default:
565
+ i++;
566
+ break;
567
+ }
568
+ }
569
+ return nodes;
570
+ }
571
+ /**
572
+ * Map an opening token (nesting=1) + its collected children to a TreeNode.
573
+ */
574
+ function openTokenToNode(token, childTokens) {
575
+ const children = tokensToTree(childTokens);
576
+ switch (token.type) {
577
+ case "heading_open": {
578
+ const level = parseInt(token.tag.slice(1), 10);
579
+ // Children should be a single "inline" token → prose node
580
+ const textHtml = children[0]?.html ?? "";
581
+ const text = textHtml.replace(/<[^>]+>/g, "").trim();
582
+ const slug = slugify(text);
583
+ return {
584
+ type: "heading",
585
+ props: { level, slug, text },
586
+ children,
587
+ };
588
+ }
589
+ case "paragraph_open":
590
+ return { type: "paragraph", children };
591
+ case "blockquote_open":
592
+ return { type: "blockquote", children };
593
+ case "ordered_list_open":
594
+ return { type: "ordered-list", children };
595
+ case "bullet_list_open":
596
+ return { type: "unordered-list", children };
597
+ case "list_item_open":
598
+ return { type: "list-item", children };
599
+ case "table_open":
600
+ return { type: "table", children };
601
+ case "thead_open":
602
+ return { type: "thead", children };
603
+ case "tbody_open":
604
+ return { type: "tbody", children };
605
+ case "tr_open":
606
+ return { type: "tr", children };
607
+ case "th_open":
608
+ return { type: "th", children };
609
+ case "td_open":
610
+ return { type: "td", children };
611
+ default:
612
+ // Unknown container — wrap children
613
+ if (children.length > 0) {
614
+ return { type: "html-container", children };
615
+ }
616
+ return null;
617
+ }
618
+ }
619
+ // ── Heading utilities ────────────────────────────────────
620
+ function slugify(text) {
621
+ return text
622
+ .toLowerCase()
623
+ .replace(/[^\w\s-]/g, "")
624
+ .replace(/\s+/g, "-")
625
+ .replace(/-+/g, "-")
626
+ .replace(/^-|-$/g, "");
627
+ }
628
+ /**
629
+ * Extract headings from a TreeNode[] tree for table of contents.
630
+ * Also ensures each heading node has slug and text props.
631
+ */
632
+ export function extractHeadings(nodes) {
633
+ const headings = [];
634
+ const seen = new Map();
635
+ function walk(nodeList) {
636
+ for (const node of nodeList) {
637
+ if (node.type === "heading") {
638
+ const level = node.props?.level ?? 1;
639
+ const text = node.props?.text ?? "";
640
+ let slug = node.props?.slug ?? slugify(text);
641
+ // Deduplicate slugs
642
+ const count = seen.get(slug) ?? 0;
643
+ if (count > 0)
644
+ slug = `${slug}-${count}`;
645
+ seen.set(slug.replace(/-\d+$/, ""), count + 1);
646
+ // Update the node props
647
+ if (!node.props)
648
+ node.props = {};
649
+ node.props.slug = slug;
650
+ node.props.text = text;
651
+ headings.push({ depth: level, slug, text });
652
+ }
653
+ if (node.children)
654
+ walk(node.children);
655
+ }
656
+ }
657
+ walk(nodes);
658
+ return headings;
659
+ }
660
+ //# sourceMappingURL=parse.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parse.js","sourceRoot":"","sources":["../src/parse.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO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AK,GAAG,CAAC;oBAAE,IAAI,GAAG,GAAG,IAAI,IAAI,KAAK,EAAE,CAAC;gBACzC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC;gBAE/C,wBAAwB;gBACxB,IAAI,CAAC,IAAI,CAAC,KAAK;oBAAE,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;gBACjC,IAAI,CAAC,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC;gBACvB,IAAI,CAAC,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC;gBAEvB,QAAQ,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;YAC9C,CAAC;YACD,IAAI,IAAI,CAAC,QAAQ;gBAAE,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACzC,CAAC;IACH,CAAC;IAED,IAAI,CAAC,KAAK,CAAC,CAAC;IACZ,OAAO,QAAQ,CAAC;AAClB,CAAC"}
package/package.json ADDED
@@ -0,0 +1,48 @@
1
+ {
2
+ "name": "@dogsbay/format-mdx",
3
+ "version": "0.2.0-beta.0",
4
+ "description": "MDX format plugin for Dogsbay — import MDX/markdown with component syntax via TreeNode[]",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js"
12
+ },
13
+ "./cli": {
14
+ "types": "./dist/cli.d.ts",
15
+ "import": "./dist/cli.js"
16
+ }
17
+ },
18
+ "files": [
19
+ "dist",
20
+ "README.md"
21
+ ],
22
+ "devDependencies": {
23
+ "@types/markdown-it": "^14.1.2",
24
+ "@types/node": "^25.5.0",
25
+ "typescript": "^5.7.0",
26
+ "vitest": "^3.0.0"
27
+ },
28
+ "license": "MIT",
29
+ "dependencies": {
30
+ "markdown-it": "^14.1.0",
31
+ "yaml": "^2.8.3",
32
+ "@dogsbay/types": "0.2.0-beta.0"
33
+ },
34
+ "repository": {
35
+ "type": "git",
36
+ "url": "https://github.com/dogsbay/dogsbay.git",
37
+ "directory": "packages/format-mdx"
38
+ },
39
+ "homepage": "https://github.com/dogsbay/dogsbay/tree/main/packages/format-mdx",
40
+ "bugs": {
41
+ "url": "https://github.com/dogsbay/dogsbay/issues"
42
+ },
43
+ "scripts": {
44
+ "build": "tsc",
45
+ "test": "vitest run --passWithNoTests",
46
+ "test:watch": "vitest"
47
+ }
48
+ }