github-markdown-adf 0.0.0-semantic-release

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/index.mjs ADDED
@@ -0,0 +1,634 @@
1
+ import { unified } from "unified";
2
+ import remarkParse from "remark-parse";
3
+ import remarkGfm from "remark-gfm";
4
+ //#region src/md-to-adf/parser.ts
5
+ function parseMarkdown(markdown) {
6
+ return unified().use(remarkParse).use(remarkGfm).parse(markdown);
7
+ }
8
+ //#endregion
9
+ //#region src/utils/language.ts
10
+ const LANGUAGE_ALIASES = {
11
+ ts: "typescript",
12
+ js: "javascript",
13
+ jsx: "javascript",
14
+ tsx: "typescript",
15
+ py: "python",
16
+ rb: "ruby",
17
+ sh: "bash",
18
+ zsh: "bash",
19
+ shell: "bash",
20
+ yml: "yaml",
21
+ md: "markdown",
22
+ rs: "rust",
23
+ kt: "kotlin",
24
+ tf: "hcl",
25
+ dockerfile: "docker"
26
+ };
27
+ function normalizeLanguage(lang) {
28
+ if (!lang) return void 0;
29
+ const lower = lang.toLowerCase().trim();
30
+ if (!lower) return void 0;
31
+ return LANGUAGE_ALIASES[lower] ?? lower;
32
+ }
33
+ //#endregion
34
+ //#region src/md-to-adf/transform/marks.ts
35
+ const OPEN_HTML_TAG = /^<(ins|sub|sup)>$/i;
36
+ const CLOSE_HTML_TAG = /^<\/(ins|sub|sup)>$/i;
37
+ function htmlTagToMark(tag) {
38
+ const t = tag.toLowerCase();
39
+ if (t === "ins") return { type: "underline" };
40
+ if (t === "sub") return {
41
+ type: "subsup",
42
+ attrs: { type: "sub" }
43
+ };
44
+ if (t === "sup") return {
45
+ type: "subsup",
46
+ attrs: { type: "sup" }
47
+ };
48
+ return null;
49
+ }
50
+ function phrasingToInlineNodes(nodes) {
51
+ const markStack = [];
52
+ const result = [];
53
+ for (const node of nodes) {
54
+ if (node.type === "html") {
55
+ const openMatch = OPEN_HTML_TAG.exec(node.value);
56
+ if (openMatch) {
57
+ const mark = htmlTagToMark(openMatch[1] ?? "");
58
+ if (mark) markStack.push(mark);
59
+ continue;
60
+ }
61
+ if (CLOSE_HTML_TAG.exec(node.value)) {
62
+ markStack.pop();
63
+ continue;
64
+ }
65
+ }
66
+ result.push(...phrasingToInline(node, markStack.slice()));
67
+ }
68
+ return result;
69
+ }
70
+ function phrasingToInline(node, inheritedMarks) {
71
+ switch (node.type) {
72
+ case "text":
73
+ if (!node.value) return [];
74
+ return [makeText(node.value, inheritedMarks)];
75
+ case "inlineCode": {
76
+ const marks = [...inheritedMarks.filter((m) => m.type === "link"), { type: "code" }];
77
+ return [makeText(node.value, marks)];
78
+ }
79
+ case "strong": return node.children.flatMap((c) => phrasingToInline(c, [...inheritedMarks, { type: "strong" }]));
80
+ case "emphasis": return node.children.flatMap((c) => phrasingToInline(c, [...inheritedMarks, { type: "em" }]));
81
+ case "delete": return node.children.flatMap((c) => phrasingToInline(c, [...inheritedMarks, { type: "strike" }]));
82
+ case "link": {
83
+ const linkMark = {
84
+ type: "link",
85
+ attrs: {
86
+ href: node.url,
87
+ ...node.title ? { title: node.title } : {}
88
+ }
89
+ };
90
+ return node.children.flatMap((c) => phrasingToInline(c, [...inheritedMarks, linkMark]));
91
+ }
92
+ case "image": return [{
93
+ type: "inlineCard",
94
+ attrs: { url: node.url }
95
+ }];
96
+ case "break": return [{ type: "hardBreak" }];
97
+ case "html": return parseHtmlInline(node.value, inheritedMarks);
98
+ case "linkReference":
99
+ case "imageReference": return [];
100
+ default: return [];
101
+ }
102
+ }
103
+ function makeText(value, marks) {
104
+ const node = {
105
+ type: "text",
106
+ text: value
107
+ };
108
+ if (marks.length > 0) node.marks = marks;
109
+ return node;
110
+ }
111
+ function parseHtmlInline(html, inheritedMarks) {
112
+ const stripped = html.replace(/<[^>]+>/g, "");
113
+ if (stripped) return [makeText(stripped, inheritedMarks)];
114
+ return [];
115
+ }
116
+ //#endregion
117
+ //#region src/md-to-adf/transform/blocks.ts
118
+ function transformHeading(node) {
119
+ return {
120
+ type: "heading",
121
+ attrs: { level: node.depth },
122
+ content: phrasingToInlineNodes(node.children)
123
+ };
124
+ }
125
+ function transformParagraph(node) {
126
+ return {
127
+ type: "paragraph",
128
+ content: phrasingToInlineNodes(node.children)
129
+ };
130
+ }
131
+ function transformCode(node) {
132
+ const result = { type: "codeBlock" };
133
+ const lang = normalizeLanguage(node.lang);
134
+ if (lang) result.attrs = { language: lang };
135
+ if (node.value) result.content = [{
136
+ type: "text",
137
+ text: node.value
138
+ }];
139
+ return result;
140
+ }
141
+ function transformThematicBreak(_node) {
142
+ return { type: "rule" };
143
+ }
144
+ const ALERT_PATTERN = /^\[!(NOTE|TIP|IMPORTANT|WARNING|CAUTION)\]\s*/i;
145
+ const ALERT_TO_PANEL = {
146
+ NOTE: "note",
147
+ TIP: "info",
148
+ IMPORTANT: "warning",
149
+ WARNING: "warning",
150
+ CAUTION: "error"
151
+ };
152
+ function transformBlockquote(node, transformChildren) {
153
+ const firstChild = node.children[0];
154
+ if (firstChild?.type === "paragraph") {
155
+ const firstText = firstChild.children[0];
156
+ if (firstText?.type === "text") {
157
+ const match = ALERT_PATTERN.exec(firstText.value);
158
+ if (match) {
159
+ const panelType = ALERT_TO_PANEL[(match[1] ?? "NOTE").toUpperCase()] ?? "info";
160
+ const remainingFirstParagraphText = firstText.value.replace(ALERT_PATTERN, "").trim();
161
+ const remainingChildren = [...firstChild.children.slice(1)];
162
+ const contentNodes = [];
163
+ if (remainingFirstParagraphText || remainingChildren.length > 0) {
164
+ const newParagraph = {
165
+ type: "paragraph",
166
+ children: [...remainingFirstParagraphText ? [{
167
+ type: "text",
168
+ value: remainingFirstParagraphText
169
+ }] : [], ...remainingChildren]
170
+ };
171
+ if (newParagraph.children.length > 0) contentNodes.push(transformParagraph(newParagraph));
172
+ }
173
+ const restChildren = node.children.slice(1);
174
+ contentNodes.push(...transformChildren(restChildren));
175
+ if (contentNodes.length === 0) contentNodes.push({
176
+ type: "paragraph",
177
+ content: []
178
+ });
179
+ return {
180
+ type: "panel",
181
+ attrs: { panelType },
182
+ content: contentNodes
183
+ };
184
+ }
185
+ }
186
+ }
187
+ const content = transformChildren(node.children);
188
+ return {
189
+ type: "blockquote",
190
+ content: content.length > 0 ? content : [{
191
+ type: "paragraph",
192
+ content: []
193
+ }]
194
+ };
195
+ }
196
+ //#endregion
197
+ //#region src/md-to-adf/transform/inlines.ts
198
+ function transformHtmlBlock(node) {
199
+ const detailsMatch = /<details[^>]*>\s*<summary[^>]*>(.*?)<\/summary>([\s\S]*?)<\/details>/i.exec(node.value);
200
+ if (detailsMatch) return {
201
+ type: "paragraph",
202
+ content: [{
203
+ type: "text",
204
+ text: (detailsMatch[1] ?? "").trim()
205
+ }]
206
+ };
207
+ const stripped = node.value.replace(/<[^>]+>/g, "").trim();
208
+ if (!stripped) return null;
209
+ return {
210
+ type: "paragraph",
211
+ content: [{
212
+ type: "text",
213
+ text: stripped
214
+ }]
215
+ };
216
+ }
217
+ //#endregion
218
+ //#region src/utils/id.ts
219
+ function generateId() {
220
+ return crypto.randomUUID();
221
+ }
222
+ //#endregion
223
+ //#region src/md-to-adf/transform/lists.ts
224
+ function transformList(node, transformBlock) {
225
+ if (node.children.some((item) => item.checked !== null && item.checked !== void 0)) return transformTaskList(node);
226
+ if (node.ordered) return transformOrderedList(node, transformBlock);
227
+ return transformBulletList(node, transformBlock);
228
+ }
229
+ function transformBulletList(node, transformBlock) {
230
+ return {
231
+ type: "bulletList",
232
+ content: node.children.map((item) => transformListItem(item, transformBlock))
233
+ };
234
+ }
235
+ function transformOrderedList(node, transformBlock) {
236
+ const result = {
237
+ type: "orderedList",
238
+ content: node.children.map((item) => transformListItem(item, transformBlock))
239
+ };
240
+ if (node.start !== null && node.start !== void 0 && node.start !== 1) result.attrs = { order: node.start };
241
+ return result;
242
+ }
243
+ function transformListItem(node, transformBlock) {
244
+ const content = [];
245
+ for (const child of node.children) if (child.type === "paragraph") content.push({
246
+ type: "paragraph",
247
+ content: phrasingToInlineNodes(child.children)
248
+ });
249
+ else if (child.type === "list") {
250
+ const nestedList = transformList(child, transformBlock);
251
+ if (nestedList.type === "taskList") {
252
+ const para = {
253
+ type: "paragraph",
254
+ content: []
255
+ };
256
+ if (content.length === 0) content.push(para);
257
+ } else {
258
+ if (content.length === 0) content.push({
259
+ type: "paragraph",
260
+ content: []
261
+ });
262
+ content.push(nestedList);
263
+ }
264
+ } else if (child.type === "code") content.push({
265
+ type: "codeBlock",
266
+ content: [{
267
+ type: "text",
268
+ text: child.value
269
+ }],
270
+ ...child.lang ? { attrs: { language: child.lang } } : {}
271
+ });
272
+ else {
273
+ const transformed = transformBlock(child);
274
+ if (transformed) {
275
+ if (transformed.type === "paragraph") content.push(transformed);
276
+ }
277
+ }
278
+ if (content.length === 0) content.push({
279
+ type: "paragraph",
280
+ content: []
281
+ });
282
+ return {
283
+ type: "listItem",
284
+ content
285
+ };
286
+ }
287
+ function transformTaskList(node) {
288
+ const listId = generateId();
289
+ const items = node.children.map((listItem) => {
290
+ const state = listItem.checked === true ? "DONE" : "TODO";
291
+ const inlineContent = listItem.children.filter((c) => c.type === "paragraph").flatMap((c) => phrasingToInlineNodes(c.children));
292
+ const taskItem = {
293
+ type: "taskItem",
294
+ attrs: {
295
+ localId: generateId(),
296
+ state
297
+ }
298
+ };
299
+ if (inlineContent.length > 0) taskItem.content = inlineContent;
300
+ return taskItem;
301
+ });
302
+ return {
303
+ type: "taskList",
304
+ attrs: { localId: listId },
305
+ content: items
306
+ };
307
+ }
308
+ //#endregion
309
+ //#region src/md-to-adf/transform/tables.ts
310
+ function transformTable(node) {
311
+ const rows = node.children;
312
+ if (rows.length === 0) return {
313
+ type: "table",
314
+ content: []
315
+ };
316
+ const headerRow = rows[0];
317
+ const bodyRows = rows.slice(1);
318
+ const adfRows = [];
319
+ if (headerRow) adfRows.push({
320
+ type: "tableRow",
321
+ content: headerRow.children.map((cell) => transformTableHeader(cell))
322
+ });
323
+ for (const row of bodyRows) adfRows.push({
324
+ type: "tableRow",
325
+ content: row.children.map((cell) => transformTableCell(cell))
326
+ });
327
+ return {
328
+ type: "table",
329
+ content: adfRows
330
+ };
331
+ }
332
+ function transformTableHeader(cell) {
333
+ const inlines = phrasingToInlineNodes(cell.children);
334
+ return {
335
+ type: "tableHeader",
336
+ attrs: {},
337
+ content: [{
338
+ type: "paragraph",
339
+ content: inlines.length > 0 ? inlines : []
340
+ }]
341
+ };
342
+ }
343
+ function transformTableCell(cell) {
344
+ const inlines = phrasingToInlineNodes(cell.children);
345
+ return {
346
+ type: "tableCell",
347
+ attrs: {},
348
+ content: [{
349
+ type: "paragraph",
350
+ content: inlines.length > 0 ? inlines : []
351
+ }]
352
+ };
353
+ }
354
+ //#endregion
355
+ //#region src/md-to-adf/transform/index.ts
356
+ function transformRoot(root) {
357
+ return {
358
+ version: 1,
359
+ type: "doc",
360
+ content: root.children.flatMap((node) => {
361
+ const result = transformBlock(node);
362
+ return result ? [result] : [];
363
+ })
364
+ };
365
+ }
366
+ function transformBlock(node) {
367
+ switch (node.type) {
368
+ case "heading": return transformHeading(node);
369
+ case "paragraph": return transformParagraph(node);
370
+ case "code": return transformCode(node);
371
+ case "thematicBreak": return transformThematicBreak(node);
372
+ case "blockquote": return transformBlockquote(node, (children) => children.flatMap((c) => {
373
+ const r = transformBlock(c);
374
+ return r ? [r] : [];
375
+ }));
376
+ case "list": return transformList(node, transformBlock);
377
+ case "table": return transformTable(node);
378
+ case "html": return transformHtmlBlock(node);
379
+ default: return null;
380
+ }
381
+ }
382
+ //#endregion
383
+ //#region src/utils/sanitize.ts
384
+ function stripNullBytes(text) {
385
+ return text.replace(/\0/g, "");
386
+ }
387
+ function normalizeNewlines(text) {
388
+ return text.replace(/\r\n/g, "\n").replace(/\r/g, "\n");
389
+ }
390
+ function trimTrailingWhitespace(text) {
391
+ return text.replace(/[^\S\n]+$/gm, "");
392
+ }
393
+ function collapseBlankLines(text) {
394
+ return text.replace(/\n{3,}/g, "\n\n");
395
+ }
396
+ function sanitizeMarkdown(text) {
397
+ return collapseBlankLines(trimTrailingWhitespace(normalizeNewlines(stripNullBytes(text))));
398
+ }
399
+ function sanitizeText(text) {
400
+ return stripNullBytes(normalizeNewlines(text));
401
+ }
402
+ //#endregion
403
+ //#region src/md-to-adf/index.ts
404
+ function mdToAdf(markdown) {
405
+ return transformRoot(parseMarkdown(sanitizeText(markdown)));
406
+ }
407
+ //#endregion
408
+ //#region src/utils/escape.ts
409
+ const INLINE_ESCAPE = /([\\`*_[\]~|<])/g;
410
+ function escapeMarkdown(text) {
411
+ let result = text.replace(INLINE_ESCAPE, "\\$1");
412
+ result = result.replace(/^(#{1,6} )/m, "\\$1");
413
+ result = result.replace(/^([-+]) /m, "\\$1 ");
414
+ result = result.replace(/^> /m, "\\> ");
415
+ result = result.replace(/^(\d+)\./m, "$1\\.");
416
+ return result;
417
+ }
418
+ //#endregion
419
+ //#region src/adf-to-md/serialize/marks.ts
420
+ function applyMarks(text, marks) {
421
+ if (!marks || marks.length === 0) return text;
422
+ let result = text;
423
+ if (marks.some((m) => m.type === "code")) {
424
+ const linkMark = marks.find((m) => m.type === "link");
425
+ result = `\`${result}\``;
426
+ if (linkMark) result = `[${result}](${linkMark.attrs.href})`;
427
+ return result;
428
+ }
429
+ for (const mark of marks) switch (mark.type) {
430
+ case "strong":
431
+ result = `**${result}**`;
432
+ break;
433
+ case "em":
434
+ result = `*${result}*`;
435
+ break;
436
+ case "strike":
437
+ result = `~~${result}~~`;
438
+ break;
439
+ case "underline":
440
+ result = `<ins>${result}</ins>`;
441
+ break;
442
+ case "subsup":
443
+ result = mark.attrs.type === "sub" ? `<sub>${result}</sub>` : `<sup>${result}</sup>`;
444
+ break;
445
+ case "link":
446
+ result = `[${result}](${mark.attrs.href}${mark.attrs.title ? ` "${mark.attrs.title}"` : ""})`;
447
+ break;
448
+ case "textColor":
449
+ case "backgroundColor":
450
+ case "alignment":
451
+ case "indentation":
452
+ case "breakout":
453
+ case "border":
454
+ case "annotation":
455
+ case "dataConsumer":
456
+ case "fragment": break;
457
+ }
458
+ return result;
459
+ }
460
+ //#endregion
461
+ //#region src/adf-to-md/serialize/inlines.ts
462
+ function serializeInlineNodes(nodes) {
463
+ if (!nodes || nodes.length === 0) return "";
464
+ return nodes.map(serializeInline).join("");
465
+ }
466
+ function serializeInline(node) {
467
+ switch (node.type) {
468
+ case "text": return applyMarks(escapeMarkdown(node.text), node.marks);
469
+ case "hardBreak": return "\\\n";
470
+ case "mention": return node.attrs.text ?? `@${node.attrs.id}`;
471
+ case "emoji": return node.attrs.text ?? `:${node.attrs.shortName}:`;
472
+ case "date": return node.attrs.timestamp;
473
+ case "status": return `\`[${node.attrs.text}]\``;
474
+ case "inlineCard": return node.attrs.url ? `<${node.attrs.url}>` : "";
475
+ case "mediaInline": return "";
476
+ default: return "";
477
+ }
478
+ }
479
+ //#endregion
480
+ //#region src/adf-to-md/serialize/blocks.ts
481
+ function serializeHeading(node) {
482
+ return `${"#".repeat(node.attrs.level)} ${serializeInlineNodes(node.content)}`;
483
+ }
484
+ function serializeParagraph(node) {
485
+ return serializeInlineNodes(node.content);
486
+ }
487
+ function serializeCodeBlock(node) {
488
+ return `\`\`\`${node.attrs?.language ?? ""}\n${node.content?.map((t) => t.text).join("") ?? ""}\n\`\`\``;
489
+ }
490
+ function serializeRule(_node) {
491
+ return "---";
492
+ }
493
+ function serializeBlockquote(node, serializeBlock) {
494
+ return node.content.map((child) => serializeBlock(child)).join("\n\n").split("\n").map((line) => `> ${line}`).join("\n");
495
+ }
496
+ //#endregion
497
+ //#region src/adf-to-md/serialize/lists.ts
498
+ function serializeBulletList(node, depth = 0) {
499
+ return node.content.map((item) => serializeListItem(item, "-", depth)).join("\n");
500
+ }
501
+ function serializeOrderedList(node, depth = 0) {
502
+ const start = node.attrs?.order ?? 1;
503
+ return node.content.map((item, i) => serializeListItem(item, `${start + i}.`, depth)).join("\n");
504
+ }
505
+ function serializeTaskList(node, depth = 0) {
506
+ return node.content.map((item) => {
507
+ return `${" ".repeat(depth)}- ${item.attrs.state === "DONE" ? "[x]" : "[ ]"} ${serializeInlineNodes(item.content)}`;
508
+ }).join("\n");
509
+ }
510
+ function serializeDecisionList(node, depth = 0) {
511
+ return node.content.map((item) => {
512
+ return `${" ".repeat(depth)}- [x] ${serializeInlineNodes(item.content)}`;
513
+ }).join("\n");
514
+ }
515
+ function serializeListItem(node, bullet, depth) {
516
+ const indent = " ".repeat(depth);
517
+ const parts = [];
518
+ for (const child of node.content) if (child.type === "paragraph") parts.push(serializeInlineNodes(child.content));
519
+ else if (child.type === "bulletList") parts.push("\n" + serializeBulletList(child, depth + 1));
520
+ else if (child.type === "orderedList") parts.push("\n" + serializeOrderedList(child, depth + 1));
521
+ else if (child.type === "codeBlock") {
522
+ const lang = child.attrs?.language ?? "";
523
+ const code = child.content?.map((t) => t.text).join("") ?? "";
524
+ parts.push(`\n\`\`\`${lang}\n${code}\n\`\`\``);
525
+ }
526
+ return `${indent}${bullet} ${parts.join("")}`;
527
+ }
528
+ //#endregion
529
+ //#region src/adf-to-md/serialize/panels.ts
530
+ const PANEL_TO_ALERT = {
531
+ note: "NOTE",
532
+ info: "TIP",
533
+ tip: "TIP",
534
+ warning: "WARNING",
535
+ success: "NOTE",
536
+ error: "CAUTION",
537
+ custom: "NOTE"
538
+ };
539
+ function serializePanel(node, serializeBlock) {
540
+ const alertType = PANEL_TO_ALERT[node.attrs.panelType] ?? "NOTE";
541
+ const contentLines = node.content.map((child) => serializeBlock(child)).join("\n\n");
542
+ return [`> [!${alertType}]`, ...contentLines.split("\n").map((l) => `> ${l}`)].join("\n");
543
+ }
544
+ function serializeExpand(node, serializeBlock) {
545
+ return `<details>\n<summary>${node.attrs.title ?? ""}</summary>\n\n${node.content.map((child) => serializeBlock(child)).join("\n\n")}\n</details>`;
546
+ }
547
+ function serializeMediaSingle(node) {
548
+ const media = node.content[0];
549
+ if (!media) return "";
550
+ const alt = media.attrs.alt ?? "image";
551
+ if (media.attrs.type === "link") {
552
+ const url = media.attrs.url;
553
+ if (url) return `![${alt}](${url})`;
554
+ }
555
+ return `[media: ${media.attrs.id}]`;
556
+ }
557
+ function serializeBlockCard(node) {
558
+ const url = node.attrs.url;
559
+ if (!url) return "";
560
+ return `[${url}](${url})`;
561
+ }
562
+ function serializeEmbedCard(node) {
563
+ return `[${node.attrs.url}](${node.attrs.url})`;
564
+ }
565
+ //#endregion
566
+ //#region src/adf-to-md/serialize/tables.ts
567
+ function serializeTable(node) {
568
+ const rows = node.content;
569
+ if (rows.length === 0) return "";
570
+ const firstRow = rows[0];
571
+ if (!firstRow) return "";
572
+ const isHeaderRow = firstRow.content.some((c) => c.type === "tableHeader");
573
+ const serializeCell = (cell) => {
574
+ const para = cell.content.find((c) => c.type === "paragraph");
575
+ if (!para) return " ";
576
+ return serializeInlineNodes(para.content).trim() || " ";
577
+ };
578
+ const lines = [];
579
+ if (isHeaderRow) {
580
+ const headerCells = firstRow.content.map(serializeCell);
581
+ lines.push(`| ${headerCells.join(" | ")} |`);
582
+ lines.push(`| ${headerCells.map(() => "---").join(" | ")} |`);
583
+ for (const row of rows.slice(1)) {
584
+ const cells = row.content.map(serializeCell);
585
+ lines.push(`| ${cells.join(" | ")} |`);
586
+ }
587
+ } else {
588
+ const colCount = firstRow.content.length;
589
+ const headerPlaceholders = Array(colCount).fill(" ");
590
+ lines.push(`| ${headerPlaceholders.join(" | ")} |`);
591
+ lines.push(`| ${headerPlaceholders.map(() => "---").join(" | ")} |`);
592
+ for (const row of rows) {
593
+ const cells = row.content.map(serializeCell);
594
+ lines.push(`| ${cells.join(" | ")} |`);
595
+ }
596
+ }
597
+ return lines.join("\n");
598
+ }
599
+ //#endregion
600
+ //#region src/adf-to-md/serialize/index.ts
601
+ function serializeBlock(node) {
602
+ switch (node.type) {
603
+ case "paragraph": return serializeParagraph(node);
604
+ case "heading": return serializeHeading(node);
605
+ case "codeBlock": return serializeCodeBlock(node);
606
+ case "rule": return serializeRule(node);
607
+ case "blockquote": return serializeBlockquote(node, serializeBlock);
608
+ case "bulletList": return serializeBulletList(node);
609
+ case "orderedList": return serializeOrderedList(node);
610
+ case "taskList": return serializeTaskList(node);
611
+ case "decisionList": return serializeDecisionList(node);
612
+ case "table": return serializeTable(node);
613
+ case "panel": return serializePanel(node, serializeBlock);
614
+ case "expand": return serializeExpand(node, serializeBlock);
615
+ case "nestedExpand": return serializeExpand(node, serializeBlock);
616
+ case "mediaSingle": return serializeMediaSingle(node);
617
+ case "blockCard": return serializeBlockCard(node);
618
+ case "embedCard": return serializeEmbedCard(node);
619
+ case "layoutSection": return serializeLayoutSection(node);
620
+ default: return "";
621
+ }
622
+ }
623
+ function serializeLayoutSection(node) {
624
+ return node.content.map((col) => col.content.map((child) => serializeBlock(child)).join("\n\n")).join("\n\n---\n\n");
625
+ }
626
+ //#endregion
627
+ //#region src/adf-to-md/index.ts
628
+ function adfToMd(adf) {
629
+ return sanitizeMarkdown(adf.content.map((node) => serializeBlock(node)).filter((p) => p.length > 0).join("\n\n"));
630
+ }
631
+ //#endregion
632
+ export { adfToMd, mdToAdf };
633
+
634
+ //# sourceMappingURL=index.mjs.map