@mintlify/cli 4.0.1549 → 4.0.1550

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.
@@ -3283,64 +3283,368 @@ var SerializerState = class {
3283
3283
  }
3284
3284
  };
3285
3285
 
3286
- // ../editor/dist/converter/serialize/handlers/media.js
3287
- function renderImage(state, node) {
3288
- var _a;
3289
- const imgAttributes = (_a = node.attrs.imgAttributes) !== null && _a !== void 0 ? _a : {};
3290
- const lightSrc = node.attrs.lightSrc;
3291
- const darkSrc = node.attrs.darkSrc;
3292
- const width = node.attrs.width;
3293
- const align = node.attrs.align;
3294
- if (lightSrc && darkSrc) {
3295
- const baseClassName = imgAttributes["className"];
3296
- writeImgTag(state, Object.assign(Object.assign({}, imgAttributes), { src: lightSrc, className: addAlignClass(baseClassName, align, "dark:hidden") }));
3297
- state.ensureNewLine();
3298
- writeImgTag(state, Object.assign(Object.assign({}, imgAttributes), { src: darkSrc, className: addAlignClass(stripToggleDisplayClass(baseClassName), align, "hidden dark:block") }));
3299
- } else {
3300
- const src = lightSrc || imgAttributes["src"];
3301
- if (!src) {
3302
- state.closeBlock();
3286
+ // ../editor/dist/converter/serialize/handlers/text.js
3287
+ var FLANKING_DELIMITER_MARKS = ["bold", "italic", "strike"];
3288
+ function usesFlanking(mark) {
3289
+ return FLANKING_DELIMITER_MARKS.includes(mark.type.name);
3290
+ }
3291
+ var MARK_PRESERVING_INLINE = /* @__PURE__ */ new Set([
3292
+ "text",
3293
+ BLOCK_TYPES.inlineImage,
3294
+ BLOCK_TYPES.inlineUnknownTag
3295
+ ]);
3296
+ var serializableMarks = (marks2) => marks2.filter((mark) => {
3297
+ const { open, close } = getMarkStrings(mark);
3298
+ return open.length > 0 || close.length > 0;
3299
+ });
3300
+ function reorderMarksForLink(marks2, parent, childIndex) {
3301
+ if (marks2.length < 2)
3302
+ return marks2;
3303
+ const linkMark = marks2.find((m) => m.type.name === "link");
3304
+ if (!linkMark)
3305
+ return marks2;
3306
+ let linkEndIndex = childIndex;
3307
+ for (let i = childIndex + 1; i < parent.childCount; i++) {
3308
+ const sibling = parent.child(i);
3309
+ if (!MARK_PRESERVING_INLINE.has(sibling.type.name) || !sibling.marks.some((m) => m.eq(linkMark)))
3310
+ break;
3311
+ linkEndIndex = i;
3312
+ }
3313
+ const nextAfterLink = linkEndIndex + 1 < parent.childCount ? parent.child(linkEndIndex + 1) : null;
3314
+ const nextMarks = nextAfterLink && MARK_PRESERVING_INLINE.has(nextAfterLink.type.name) ? nextAfterLink.marks : [];
3315
+ const otherMarks = marks2.filter((m) => !m.eq(linkMark));
3316
+ const anyFormattingContinues = otherMarks.some((m) => nextMarks.some((nm) => nm.eq(m)));
3317
+ if (anyFormattingContinues)
3318
+ return marks2;
3319
+ return [linkMark, ...otherMarks];
3320
+ }
3321
+ function renderInline(state, node, renderNode2, inlineRenderers2) {
3322
+ let active = [];
3323
+ const transitionMarks = (newMarks) => {
3324
+ const closingIndices = /* @__PURE__ */ new Set();
3325
+ for (let i = 0; i < active.length; i++) {
3326
+ const activeMark = active[i];
3327
+ if (activeMark && !newMarks.some((m) => m.eq(activeMark))) {
3328
+ closingIndices.add(i);
3329
+ }
3330
+ }
3331
+ const opening = [];
3332
+ for (const mark of newMarks) {
3333
+ if (!active.some((a) => a.eq(mark))) {
3334
+ opening.push(mark);
3335
+ }
3336
+ }
3337
+ if (closingIndices.size === 0 && opening.length === 0)
3303
3338
  return;
3339
+ const codeIndex = active.findIndex((m) => m.type.name === "code");
3340
+ const interruptCode = opening.length > 0 && codeIndex !== -1 && !closingIndices.has(codeIndex);
3341
+ let deferredCode;
3342
+ if (closingIndices.size > 0 || interruptCode) {
3343
+ let earliestClose = active.length;
3344
+ for (const idx of closingIndices) {
3345
+ earliestClose = Math.min(earliestClose, idx);
3346
+ }
3347
+ if (interruptCode) {
3348
+ earliestClose = Math.min(earliestClose, codeIndex);
3349
+ }
3350
+ let trailingSpace = "";
3351
+ let trailingTextMapping = null;
3352
+ const closingFlanking = [...closingIndices].some((idx) => {
3353
+ const m = active[idx];
3354
+ return m !== void 0 && usesFlanking(m);
3355
+ });
3356
+ if (closingFlanking) {
3357
+ const spaces = state.trailingSpaceCount;
3358
+ if (spaces > 0) {
3359
+ trailingSpace = " ".repeat(spaces);
3360
+ trailingTextMapping = state.takeTextSuffix(spaces);
3361
+ state.truncate(spaces);
3362
+ }
3363
+ }
3364
+ for (let i = active.length - 1; i >= earliestClose; i--) {
3365
+ const mark = active[i];
3366
+ if (mark) {
3367
+ state.write(getMarkStrings(mark).close);
3368
+ }
3369
+ }
3370
+ const continuing = [];
3371
+ for (let i = earliestClose; i < active.length; i++) {
3372
+ if (!closingIndices.has(i)) {
3373
+ const mark = active[i];
3374
+ if (mark)
3375
+ continuing.push(mark);
3376
+ }
3377
+ }
3378
+ active = active.slice(0, earliestClose);
3379
+ if (trailingSpace) {
3380
+ const trailingStart = state.length;
3381
+ state.write(trailingSpace);
3382
+ if (trailingTextMapping) {
3383
+ state.recordTextRange(trailingTextMapping, trailingStart, state.length);
3384
+ }
3385
+ }
3386
+ for (const mark of continuing) {
3387
+ if (mark.type.name === "code") {
3388
+ deferredCode = mark;
3389
+ continue;
3390
+ }
3391
+ state.write(getMarkStrings(mark).open);
3392
+ active.push(mark);
3393
+ }
3304
3394
  }
3305
- const hasExtraAttrs = Object.keys(imgAttributes).some((attr) => attr !== "src" && attr !== "alt" && attr !== "title");
3306
- if (hasExtraAttrs || width || align || !fitsMarkdownImageValues(Object.assign(Object.assign({}, imgAttributes), { src }))) {
3307
- const finalAttrs = Object.assign(Object.assign({}, imgAttributes), { src });
3308
- if (align) {
3309
- finalAttrs["className"] = addAlignClass(finalAttrs["className"], align);
3395
+ for (const mark of opening) {
3396
+ if (mark.type.name === "code") {
3397
+ deferredCode = mark;
3398
+ continue;
3310
3399
  }
3311
- if (width && width !== 100) {
3312
- finalAttrs["style"] = Object.assign(Object.assign({}, typeof finalAttrs["style"] === "object" ? finalAttrs["style"] : {}), { width: `${width}%` });
3400
+ state.write(getMarkStrings(mark).open);
3401
+ active.push(mark);
3402
+ }
3403
+ if (deferredCode) {
3404
+ state.write(getMarkStrings(deferredCode).open);
3405
+ active.push(deferredCode);
3406
+ }
3407
+ };
3408
+ for (let i = 0; i < node.childCount; i++) {
3409
+ const child = node.child(i);
3410
+ const typeName = child.type.name;
3411
+ if (typeName === "text") {
3412
+ let text = child.text || "";
3413
+ if (!text)
3414
+ continue;
3415
+ const textLength = text.length;
3416
+ let pmOffset = 0;
3417
+ const childMarks = serializableMarks(child.marks);
3418
+ const openingFlanking = childMarks.some((m) => usesFlanking(m) && !active.some((a) => a.eq(m)));
3419
+ if (openingFlanking) {
3420
+ const leadingMatch = text.match(/^( +)/);
3421
+ if (leadingMatch) {
3422
+ state.write(leadingMatch[0]);
3423
+ state.recordTextSuffix(i, leadingMatch[0].length, 0, leadingMatch[0].length);
3424
+ pmOffset = leadingMatch[0].length;
3425
+ text = text.slice(leadingMatch[0].length);
3426
+ if (!text)
3427
+ continue;
3428
+ }
3313
3429
  }
3314
- writeImgTag(state, finalAttrs);
3430
+ const marks2 = reorderMarksForLink(childMarks, node, i);
3431
+ transitionMarks(marks2);
3432
+ const written = active.some((m) => m.type.name === "code") ? state.escCodeText(text) : state.esc(text, { inLinkText: active.some((m) => m.type.name === "link") });
3433
+ state.write(written);
3434
+ state.recordTextSuffix(i, written.length, pmOffset, textLength);
3315
3435
  } else {
3316
- writeMarkdownImage(state, imgAttributes, src);
3436
+ if (typeName === BLOCK_TYPES.inlineImage) {
3437
+ transitionMarks(reorderMarksForLink(serializableMarks(child.marks), node, i));
3438
+ inlineRenderers2.renderInlineImage(state, child);
3439
+ continue;
3440
+ }
3441
+ if (typeName === BLOCK_TYPES.inlineUnknownTag) {
3442
+ transitionMarks(reorderMarksForLink(serializableMarks(child.marks), node, i));
3443
+ state.withNodePath(i, () => inlineRenderers2.renderUnknownTag(state, child));
3444
+ continue;
3445
+ }
3446
+ transitionMarks([]);
3447
+ if (typeName === "hardBreak") {
3448
+ state.write("<br />");
3449
+ } else if (typeName === BLOCK_TYPES.icon) {
3450
+ inlineRenderers2.renderIcon(state, child);
3451
+ } else if (typeName === BLOCK_TYPES.badge) {
3452
+ inlineRenderers2.renderBadge(state, child);
3453
+ } else if (typeName === BLOCK_TYPES.tooltip) {
3454
+ state.withNodePath(i, () => inlineRenderers2.renderTooltip(state, child));
3455
+ } else if (typeName === BLOCK_TYPES.inlineMath) {
3456
+ if (child.attrs.expression) {
3457
+ state.write(`$$${child.attrs.expression}$$`);
3458
+ }
3459
+ } else {
3460
+ renderNode2(state, child, node, 0);
3461
+ }
3317
3462
  }
3318
3463
  }
3319
- state.closeBlock();
3464
+ transitionMarks([]);
3320
3465
  }
3321
- function addAlignClass(existing, align, extra) {
3322
- var _a;
3323
- let classes = existing ? existing.trim() : "";
3324
- if (align && align in IMAGE_ALIGN_CLASSES) {
3325
- classes = classes.split(" ").filter((c) => !c.match(/mr-auto|ml-auto|mx-auto/)).join(" ");
3326
- const alignClass = (_a = IMAGE_ALIGN_CLASSES[align]) !== null && _a !== void 0 ? _a : "";
3327
- classes = classes ? `${classes} ${alignClass}` : alignClass;
3466
+ function renderTextNode(state, node) {
3467
+ const text = node.text || "";
3468
+ if (!text)
3469
+ return;
3470
+ const marks2 = serializableMarks(node.marks);
3471
+ let openMarks = "";
3472
+ let closeMarks = "";
3473
+ for (const mark of marks2) {
3474
+ const { open, close } = getMarkStrings(mark);
3475
+ openMarks += open;
3476
+ closeMarks = close + closeMarks;
3328
3477
  }
3329
- if (extra) {
3330
- classes = classes ? `${classes} ${extra}` : extra;
3478
+ if (marks2.length > 0) {
3479
+ let innerText = text;
3480
+ let leadingSpace = "";
3481
+ let trailingSpace = "";
3482
+ if (marks2.some(usesFlanking)) {
3483
+ const leadingMatch = innerText.match(/^( +)/);
3484
+ if (leadingMatch) {
3485
+ leadingSpace = leadingMatch[0];
3486
+ innerText = innerText.slice(leadingSpace.length);
3487
+ }
3488
+ const trailingMatch = innerText.match(/( +)$/);
3489
+ if (trailingMatch) {
3490
+ trailingSpace = trailingMatch[0];
3491
+ innerText = innerText.slice(0, -trailingSpace.length);
3492
+ }
3493
+ if (!innerText) {
3494
+ state.text(text);
3495
+ return;
3496
+ }
3497
+ }
3498
+ if (leadingSpace)
3499
+ state.write(leadingSpace);
3500
+ state.write(openMarks);
3501
+ state.write(marks2.some((m) => m.type.name === "code") ? state.escCodeText(innerText) : state.esc(innerText, { inLinkText: marks2.some((m) => m.type.name === "link") }));
3502
+ state.write(closeMarks);
3503
+ if (trailingSpace)
3504
+ state.write(trailingSpace);
3505
+ } else {
3506
+ state.text(text);
3331
3507
  }
3332
- return classes || void 0;
3333
3508
  }
3334
- function stripToggleDisplayClass(className) {
3335
- if (!className)
3336
- return void 0;
3337
- const result = className.split(/\s+/).filter((c) => c !== "block").join(" ").trim();
3338
- return result || void 0;
3509
+ function escapeReferenceLabel(label) {
3510
+ return label.replace(/\\(?=[\u0021-\u002F\u003A-\u0040\u005B-\u0060\u007B-\u007E]|$)/g, "\\\\").replace(/[\[\]]/g, "\\$&");
3339
3511
  }
3340
- function writeImgTag(state, attrs2) {
3341
- state.write("<img");
3342
- state.ensureNewLine();
3343
- for (const [key, value] of Object.entries(attrs2)) {
3512
+ function getMarkStrings(mark) {
3513
+ switch (mark.type.name) {
3514
+ case "bold":
3515
+ return { open: "**", close: "**" };
3516
+ case "italic":
3517
+ return { open: "_", close: "_" };
3518
+ case "strike":
3519
+ return { open: "~~", close: "~~" };
3520
+ case "code":
3521
+ return { open: "`", close: "`" };
3522
+ case "link": {
3523
+ const componentLink = getLinkComponentMarkStrings(mark);
3524
+ if (componentLink)
3525
+ return componentLink;
3526
+ const referenceLabel = mark.attrs.referenceLabel;
3527
+ if (typeof referenceLabel === "string" && referenceLabel) {
3528
+ return { open: "[", close: `][${escapeReferenceLabel(referenceLabel)}]` };
3529
+ }
3530
+ const href = mark.attrs.href || "";
3531
+ const title = mark.attrs.title;
3532
+ const titleStr = title ? ` "${title}"` : "";
3533
+ return {
3534
+ open: "[",
3535
+ close: `](${href.replace(/[()]/g, "\\$&")}${titleStr})`
3536
+ };
3537
+ }
3538
+ case "underline":
3539
+ return { open: "<u>", close: "</u>" };
3540
+ case "subscript":
3541
+ return { open: "<sub>", close: "</sub>" };
3542
+ case "superscript":
3543
+ return { open: "<sup>", close: "</sup>" };
3544
+ case "kbd":
3545
+ return { open: "<kbd>", close: "</kbd>" };
3546
+ default:
3547
+ return { open: "", close: "" };
3548
+ }
3549
+ }
3550
+ function getLinkComponentMarkStrings(mark) {
3551
+ const storedAttributes = mark.attrs.mdxLinkAttributes;
3552
+ const href = mark.attrs.href;
3553
+ if (!isAttributeRecord3(storedAttributes) || typeof href !== "string")
3554
+ return void 0;
3555
+ const attributes = Object.assign(Object.assign({}, storedAttributes), { href });
3556
+ if (mark.attrs.title === null || mark.attrs.title === void 0) {
3557
+ delete attributes.title;
3558
+ } else {
3559
+ attributes.title = mark.attrs.title;
3560
+ }
3561
+ const namedAttributes = Object.entries(attributes).filter(([key]) => key !== NAMED_EXPRESSION_ATTRS_KEY).map(([key, value]) => serializeJsxAttribute(attributes, key, value)).filter((attribute) => attribute !== null);
3562
+ const serializedAttributes = namedAttributes.join(" ");
3563
+ return {
3564
+ open: `<Link${serializedAttributes ? ` ${serializedAttributes}` : ""}>`,
3565
+ close: "</Link>"
3566
+ };
3567
+ }
3568
+ function isAttributeRecord3(value) {
3569
+ return typeof value === "object" && value !== null && !Array.isArray(value);
3570
+ }
3571
+
3572
+ // ../editor/dist/converter/serialize/handlers/media.js
3573
+ function readImageAttributes2(node) {
3574
+ const { imgAttributes } = node.attrs;
3575
+ return isAttributeRecord3(imgAttributes) ? imgAttributes : {};
3576
+ }
3577
+ function classifyImage(node) {
3578
+ const { lightSrc, darkSrc, width, align } = node.attrs;
3579
+ const imgAttributes = readImageAttributes2(node);
3580
+ if (lightSrc && darkSrc)
3581
+ return { kind: "lightDarkPair" };
3582
+ const src = lightSrc || imgAttributes["src"];
3583
+ if (!src)
3584
+ return { kind: "none" };
3585
+ if (typeof src !== "string")
3586
+ return { kind: "jsx" };
3587
+ const hasExtraAttrs = Object.keys(imgAttributes).some((attr) => attr !== "src" && attr !== "alt" && attr !== "title");
3588
+ if (hasExtraAttrs || width || align || !fitsMarkdownImageValues(Object.assign(Object.assign({}, imgAttributes), { src }))) {
3589
+ return { kind: "jsx" };
3590
+ }
3591
+ return { kind: "markdown", src };
3592
+ }
3593
+ function isMarkdownImage(node) {
3594
+ return classifyImage(node).kind === "markdown";
3595
+ }
3596
+ function renderImage(state, node) {
3597
+ const imgAttributes = readImageAttributes2(node);
3598
+ const lightSrc = node.attrs.lightSrc;
3599
+ const darkSrc = node.attrs.darkSrc;
3600
+ const width = node.attrs.width;
3601
+ const align = node.attrs.align;
3602
+ const output = classifyImage(node);
3603
+ if (output.kind === "lightDarkPair") {
3604
+ const baseClassName = imgAttributes["className"];
3605
+ writeImgTag(state, Object.assign(Object.assign({}, imgAttributes), { src: lightSrc, className: addAlignClass(baseClassName, align, "dark:hidden") }));
3606
+ state.ensureNewLine();
3607
+ writeImgTag(state, Object.assign(Object.assign({}, imgAttributes), { src: darkSrc, className: addAlignClass(stripToggleDisplayClass(baseClassName), align, "hidden dark:block") }));
3608
+ } else if (output.kind !== "none") {
3609
+ const src = lightSrc || imgAttributes["src"];
3610
+ if (output.kind === "jsx") {
3611
+ const finalAttrs = Object.assign(Object.assign({}, imgAttributes), { src });
3612
+ if (align) {
3613
+ finalAttrs["className"] = addAlignClass(finalAttrs["className"], align);
3614
+ }
3615
+ if (width && width !== 100) {
3616
+ finalAttrs["style"] = Object.assign(Object.assign({}, typeof finalAttrs["style"] === "object" ? finalAttrs["style"] : {}), { width: `${width}%` });
3617
+ }
3618
+ writeImgTag(state, finalAttrs);
3619
+ } else {
3620
+ writeMarkdownImage(state, imgAttributes, output.src);
3621
+ }
3622
+ }
3623
+ state.closeBlock();
3624
+ }
3625
+ function addAlignClass(existing, align, extra) {
3626
+ var _a;
3627
+ let classes = existing ? existing.trim() : "";
3628
+ if (align && align in IMAGE_ALIGN_CLASSES) {
3629
+ classes = classes.split(" ").filter((c) => !c.match(/mr-auto|ml-auto|mx-auto/)).join(" ");
3630
+ const alignClass = (_a = IMAGE_ALIGN_CLASSES[align]) !== null && _a !== void 0 ? _a : "";
3631
+ classes = classes ? `${classes} ${alignClass}` : alignClass;
3632
+ }
3633
+ if (extra) {
3634
+ classes = classes ? `${classes} ${extra}` : extra;
3635
+ }
3636
+ return classes || void 0;
3637
+ }
3638
+ function stripToggleDisplayClass(className) {
3639
+ if (!className)
3640
+ return void 0;
3641
+ const result = className.split(/\s+/).filter((c) => c !== "block").join(" ").trim();
3642
+ return result || void 0;
3643
+ }
3644
+ function writeImgTag(state, attrs2) {
3645
+ state.write("<img");
3646
+ state.ensureNewLine();
3647
+ for (const [key, value] of Object.entries(attrs2)) {
3344
3648
  if (value === null || value === void 0)
3345
3649
  continue;
3346
3650
  if (HIDDEN_NODE_ATTRS.has(key))
@@ -4073,466 +4377,180 @@ function renderMermaidBlock(state, node) {
4073
4377
  state.write(fence + "mermaid" + metaString + "\n");
4074
4378
  state.write(content);
4075
4379
  state.ensureNewLine();
4076
- state.write(fence);
4077
- state.closeBlock();
4078
- }
4079
- function renderPromptBlock(state, node, renderContent2) {
4080
- const descNode = node.childCount > 0 ? node.child(0) : null;
4081
- const codeBlockNode = node.childCount > 1 ? node.child(1) : null;
4082
- let descriptionMd = "";
4083
- if (descNode) {
4084
- const descState = new SerializerState(state.options);
4085
- renderContent2(descState, descNode);
4086
- descriptionMd = descState.out.trim();
4087
- }
4088
- const rawChildren = codeBlockNode ? getTextContent(codeBlockNode) : "";
4089
- const props = [];
4090
- if (descriptionMd) {
4091
- if (descriptionMd.includes('"')) {
4092
- const escaped = descriptionMd.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$\{/g, "\\${");
4093
- props.push(`description={\`${escaped}\`}`);
4094
- } else {
4095
- props.push(`description="${descriptionMd}"`);
4096
- }
4097
- }
4098
- if (node.attrs.icon)
4099
- props.push(`icon="${node.attrs.icon}"`);
4100
- if (node.attrs.iconType)
4101
- props.push(`iconType="${node.attrs.iconType}"`);
4102
- const actions = Array.isArray(node.attrs.actions) ? node.attrs.actions : ["copy"];
4103
- props.push(`actions={[${actions.map((a) => `"${a}"`).join(", ")}]}`);
4104
- const propsStr = props.length > 0 ? " " + props.join(" ") : "";
4105
- state.write(`<Prompt${propsStr}${extraAttrsPropString(node.attrs)}>`);
4106
- if (rawChildren) {
4107
- state.ensureNewLine();
4108
- state.write(rawChildren);
4109
- }
4110
- state.ensureNewLine();
4111
- state.write("</Prompt>");
4112
- state.closeBlock();
4113
- }
4114
- function serializeColorItemTag(item) {
4115
- const parts = [];
4116
- if (item.name) {
4117
- const nameProp = serializeJsxAttribute({}, "name", item.name);
4118
- if (nameProp)
4119
- parts.push(nameProp);
4120
- }
4121
- if (item.rawValueExpr !== void 0) {
4122
- parts.push(`value={${item.rawValueExpr}}`);
4123
- } else if (item.value !== void 0 && item.value !== null) {
4124
- const valueProp = serializeJsxAttribute({}, "value", item.value);
4125
- if (valueProp)
4126
- parts.push(valueProp);
4127
- }
4128
- return `<Color.Item${parts.length ? " " + parts.join(" ") : ""} />`;
4129
- }
4130
- function renderColor(state, node) {
4131
- var _a;
4132
- const variant = node.attrs.variant;
4133
- const colorData = (_a = node.attrs.colorData) !== null && _a !== void 0 ? _a : [];
4134
- const variantProp = variant ? ` variant="${variant}"` : "";
4135
- state.write(`<Color${variantProp}${extraAttrsPropString(node.attrs)}>`);
4136
- state.ensureNewLine();
4137
- const prevDelim = state.delim;
4138
- state.delim += " ".repeat(state.indentSize);
4139
- for (const child of colorData) {
4140
- if (child.type === "row") {
4141
- const titleProp = child.title ? serializeJsxAttribute({}, "title", child.title) : null;
4142
- state.write(`<Color.Row${titleProp ? ` ${titleProp}` : ""}>`);
4143
- state.ensureNewLine();
4144
- const rowPrevDelim = state.delim;
4145
- state.delim += " ".repeat(state.indentSize);
4146
- for (const item of child.items) {
4147
- state.write(serializeColorItemTag(item));
4148
- state.ensureNewLine();
4149
- }
4150
- state.delim = rowPrevDelim;
4151
- state.closed = false;
4152
- state.ensureNewLine();
4153
- state.write("</Color.Row>");
4154
- state.ensureNewLine();
4155
- } else {
4156
- state.write(serializeColorItemTag(child));
4157
- state.ensureNewLine();
4158
- }
4159
- }
4160
- state.delim = prevDelim;
4161
- state.closed = false;
4162
- state.ensureNewLine();
4163
- state.write("</Color>");
4164
- state.closeBlock();
4165
- }
4166
- function serializeTreeChildAttrs(attrs2) {
4167
- const parts = [];
4168
- for (const [key, value] of Object.entries(attrs2)) {
4169
- if (value === void 0)
4170
- continue;
4171
- const prop = serializeJsxAttribute({}, key, value);
4172
- if (prop)
4173
- parts.push(prop);
4174
- }
4175
- return parts.length ? " " + parts.join(" ") : "";
4176
- }
4177
- function writeTreeChild(state, child) {
4178
- if (child.type === "file") {
4179
- const attrStr2 = serializeTreeChildAttrs({ name: child.name });
4180
- state.write(`<Tree.File${attrStr2} />`);
4181
- state.ensureNewLine();
4182
- return;
4183
- }
4184
- const attrStr = serializeTreeChildAttrs({
4185
- name: child.name,
4186
- defaultOpen: child.defaultOpen,
4187
- openable: child.openable
4188
- });
4189
- if (child.children.length === 0) {
4190
- state.write(`<Tree.Folder${attrStr} />`);
4191
- state.ensureNewLine();
4192
- return;
4193
- }
4194
- state.write(`<Tree.Folder${attrStr}>`);
4195
- state.ensureNewLine();
4196
- const prevDelim = state.delim;
4197
- state.delim += " ".repeat(state.indentSize);
4198
- for (const grandchild of child.children) {
4199
- writeTreeChild(state, grandchild);
4200
- }
4201
- state.delim = prevDelim;
4202
- state.closed = false;
4203
- state.ensureNewLine();
4204
- state.write("</Tree.Folder>");
4205
- state.ensureNewLine();
4206
- }
4207
- function renderTree(state, node) {
4208
- var _a;
4209
- const treeData = (_a = node.attrs.treeData) !== null && _a !== void 0 ? _a : [];
4210
- const extraTreeAttrs = extraAttrsPropString(node.attrs);
4211
- if (treeData.length === 0) {
4212
- state.write(`<Tree${extraTreeAttrs} />`);
4213
- state.closeBlock();
4214
- return;
4215
- }
4216
- state.write(`<Tree${extraTreeAttrs}>`);
4217
- state.ensureNewLine();
4218
- const prevDelim = state.delim;
4219
- state.delim += " ".repeat(state.indentSize);
4220
- for (const child of treeData) {
4221
- writeTreeChild(state, child);
4222
- }
4223
- state.delim = prevDelim;
4224
- state.closed = false;
4225
- state.ensureNewLine();
4226
- state.write("</Tree>");
4227
- state.closeBlock();
4228
- }
4229
- function getExpressionAttrStrings(attrs2) {
4230
- const raw = attrs2[EXPRESSION_ATTRS_KEY];
4231
- if (!Array.isArray(raw))
4232
- return [];
4233
- return raw.map((v) => `{${v}}`);
4234
- }
4235
- function mergeExtraAttrs(attrs2) {
4236
- const extra = attrs2[EXTRA_ATTRS_KEY];
4237
- if (!extra || typeof extra !== "object")
4238
- return attrs2;
4239
- return Object.assign(Object.assign({}, attrs2), extra);
4240
- }
4241
- function extraAttrsPropString(nodeAttrs) {
4242
- const extra = nodeAttrs[EXTRA_ATTRS_KEY];
4243
- if (!extra || typeof extra !== "object")
4244
- return "";
4245
- const entries = Object.entries(extra);
4246
- if (entries.length === 0)
4247
- return "";
4248
- const props = entries.map(([key, value]) => serializeJsxAttribute(extra, key, value)).filter(Boolean);
4249
- return props.length > 0 ? " " + props.join(" ") : "";
4250
- }
4251
-
4252
- // ../editor/dist/converter/serialize/handlers/text.js
4253
- var FLANKING_DELIMITER_MARKS = ["bold", "italic", "strike"];
4254
- function usesFlanking(mark) {
4255
- return FLANKING_DELIMITER_MARKS.includes(mark.type.name);
4256
- }
4257
- var MARK_PRESERVING_INLINE = /* @__PURE__ */ new Set([
4258
- "text",
4259
- BLOCK_TYPES.inlineImage,
4260
- BLOCK_TYPES.inlineUnknownTag
4261
- ]);
4262
- var serializableMarks = (marks2) => marks2.filter((mark) => {
4263
- const { open, close } = getMarkStrings(mark);
4264
- return open.length > 0 || close.length > 0;
4265
- });
4266
- function reorderMarksForLink(marks2, parent, childIndex) {
4267
- if (marks2.length < 2)
4268
- return marks2;
4269
- const linkMark = marks2.find((m) => m.type.name === "link");
4270
- if (!linkMark)
4271
- return marks2;
4272
- let linkEndIndex = childIndex;
4273
- for (let i = childIndex + 1; i < parent.childCount; i++) {
4274
- const sibling = parent.child(i);
4275
- if (!MARK_PRESERVING_INLINE.has(sibling.type.name) || !sibling.marks.some((m) => m.eq(linkMark)))
4276
- break;
4277
- linkEndIndex = i;
4278
- }
4279
- const nextAfterLink = linkEndIndex + 1 < parent.childCount ? parent.child(linkEndIndex + 1) : null;
4280
- const nextMarks = nextAfterLink && MARK_PRESERVING_INLINE.has(nextAfterLink.type.name) ? nextAfterLink.marks : [];
4281
- const otherMarks = marks2.filter((m) => !m.eq(linkMark));
4282
- const anyFormattingContinues = otherMarks.some((m) => nextMarks.some((nm) => nm.eq(m)));
4283
- if (anyFormattingContinues)
4284
- return marks2;
4285
- return [linkMark, ...otherMarks];
4286
- }
4287
- function renderInline(state, node, renderNode2, inlineRenderers2) {
4288
- let active = [];
4289
- const transitionMarks = (newMarks) => {
4290
- const closingIndices = /* @__PURE__ */ new Set();
4291
- for (let i = 0; i < active.length; i++) {
4292
- const activeMark = active[i];
4293
- if (activeMark && !newMarks.some((m) => m.eq(activeMark))) {
4294
- closingIndices.add(i);
4295
- }
4296
- }
4297
- const opening = [];
4298
- for (const mark of newMarks) {
4299
- if (!active.some((a) => a.eq(mark))) {
4300
- opening.push(mark);
4301
- }
4302
- }
4303
- if (closingIndices.size === 0 && opening.length === 0)
4304
- return;
4305
- const codeIndex = active.findIndex((m) => m.type.name === "code");
4306
- const interruptCode = opening.length > 0 && codeIndex !== -1 && !closingIndices.has(codeIndex);
4307
- let deferredCode;
4308
- if (closingIndices.size > 0 || interruptCode) {
4309
- let earliestClose = active.length;
4310
- for (const idx of closingIndices) {
4311
- earliestClose = Math.min(earliestClose, idx);
4312
- }
4313
- if (interruptCode) {
4314
- earliestClose = Math.min(earliestClose, codeIndex);
4315
- }
4316
- let trailingSpace = "";
4317
- let trailingTextMapping = null;
4318
- const closingFlanking = [...closingIndices].some((idx) => {
4319
- const m = active[idx];
4320
- return m !== void 0 && usesFlanking(m);
4321
- });
4322
- if (closingFlanking) {
4323
- const spaces = state.trailingSpaceCount;
4324
- if (spaces > 0) {
4325
- trailingSpace = " ".repeat(spaces);
4326
- trailingTextMapping = state.takeTextSuffix(spaces);
4327
- state.truncate(spaces);
4328
- }
4329
- }
4330
- for (let i = active.length - 1; i >= earliestClose; i--) {
4331
- const mark = active[i];
4332
- if (mark) {
4333
- state.write(getMarkStrings(mark).close);
4334
- }
4335
- }
4336
- const continuing = [];
4337
- for (let i = earliestClose; i < active.length; i++) {
4338
- if (!closingIndices.has(i)) {
4339
- const mark = active[i];
4340
- if (mark)
4341
- continuing.push(mark);
4342
- }
4343
- }
4344
- active = active.slice(0, earliestClose);
4345
- if (trailingSpace) {
4346
- const trailingStart = state.length;
4347
- state.write(trailingSpace);
4348
- if (trailingTextMapping) {
4349
- state.recordTextRange(trailingTextMapping, trailingStart, state.length);
4350
- }
4351
- }
4352
- for (const mark of continuing) {
4353
- if (mark.type.name === "code") {
4354
- deferredCode = mark;
4355
- continue;
4356
- }
4357
- state.write(getMarkStrings(mark).open);
4358
- active.push(mark);
4359
- }
4360
- }
4361
- for (const mark of opening) {
4362
- if (mark.type.name === "code") {
4363
- deferredCode = mark;
4364
- continue;
4365
- }
4366
- state.write(getMarkStrings(mark).open);
4367
- active.push(mark);
4368
- }
4369
- if (deferredCode) {
4370
- state.write(getMarkStrings(deferredCode).open);
4371
- active.push(deferredCode);
4372
- }
4373
- };
4374
- for (let i = 0; i < node.childCount; i++) {
4375
- const child = node.child(i);
4376
- const typeName = child.type.name;
4377
- if (typeName === "text") {
4378
- let text = child.text || "";
4379
- if (!text)
4380
- continue;
4381
- const textLength = text.length;
4382
- let pmOffset = 0;
4383
- const childMarks = serializableMarks(child.marks);
4384
- const openingFlanking = childMarks.some((m) => usesFlanking(m) && !active.some((a) => a.eq(m)));
4385
- if (openingFlanking) {
4386
- const leadingMatch = text.match(/^( +)/);
4387
- if (leadingMatch) {
4388
- state.write(leadingMatch[0]);
4389
- state.recordTextSuffix(i, leadingMatch[0].length, 0, leadingMatch[0].length);
4390
- pmOffset = leadingMatch[0].length;
4391
- text = text.slice(leadingMatch[0].length);
4392
- if (!text)
4393
- continue;
4394
- }
4395
- }
4396
- const marks2 = reorderMarksForLink(childMarks, node, i);
4397
- transitionMarks(marks2);
4398
- const written = active.some((m) => m.type.name === "code") ? state.escCodeText(text) : state.esc(text, { inLinkText: active.some((m) => m.type.name === "link") });
4399
- state.write(written);
4400
- state.recordTextSuffix(i, written.length, pmOffset, textLength);
4401
- } else {
4402
- if (typeName === BLOCK_TYPES.inlineImage) {
4403
- transitionMarks(reorderMarksForLink(serializableMarks(child.marks), node, i));
4404
- inlineRenderers2.renderInlineImage(state, child);
4405
- continue;
4406
- }
4407
- if (typeName === BLOCK_TYPES.inlineUnknownTag) {
4408
- transitionMarks(reorderMarksForLink(serializableMarks(child.marks), node, i));
4409
- state.withNodePath(i, () => inlineRenderers2.renderUnknownTag(state, child));
4410
- continue;
4411
- }
4412
- transitionMarks([]);
4413
- if (typeName === "hardBreak") {
4414
- state.write("<br />");
4415
- } else if (typeName === BLOCK_TYPES.icon) {
4416
- inlineRenderers2.renderIcon(state, child);
4417
- } else if (typeName === BLOCK_TYPES.badge) {
4418
- inlineRenderers2.renderBadge(state, child);
4419
- } else if (typeName === BLOCK_TYPES.tooltip) {
4420
- state.withNodePath(i, () => inlineRenderers2.renderTooltip(state, child));
4421
- } else if (typeName === BLOCK_TYPES.inlineMath) {
4422
- if (child.attrs.expression) {
4423
- state.write(`$$${child.attrs.expression}$$`);
4424
- }
4425
- } else {
4426
- renderNode2(state, child, node, 0);
4427
- }
4380
+ state.write(fence);
4381
+ state.closeBlock();
4382
+ }
4383
+ function renderPromptBlock(state, node, renderContent2) {
4384
+ const descNode = node.childCount > 0 ? node.child(0) : null;
4385
+ const codeBlockNode = node.childCount > 1 ? node.child(1) : null;
4386
+ let descriptionMd = "";
4387
+ if (descNode) {
4388
+ const descState = new SerializerState(state.options);
4389
+ renderContent2(descState, descNode);
4390
+ descriptionMd = descState.out.trim();
4391
+ }
4392
+ const rawChildren = codeBlockNode ? getTextContent(codeBlockNode) : "";
4393
+ const props = [];
4394
+ if (descriptionMd) {
4395
+ if (descriptionMd.includes('"')) {
4396
+ const escaped = descriptionMd.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$\{/g, "\\${");
4397
+ props.push(`description={\`${escaped}\`}`);
4398
+ } else {
4399
+ props.push(`description="${descriptionMd}"`);
4428
4400
  }
4429
4401
  }
4430
- transitionMarks([]);
4402
+ if (node.attrs.icon)
4403
+ props.push(`icon="${node.attrs.icon}"`);
4404
+ if (node.attrs.iconType)
4405
+ props.push(`iconType="${node.attrs.iconType}"`);
4406
+ const actions = Array.isArray(node.attrs.actions) ? node.attrs.actions : ["copy"];
4407
+ props.push(`actions={[${actions.map((a) => `"${a}"`).join(", ")}]}`);
4408
+ const propsStr = props.length > 0 ? " " + props.join(" ") : "";
4409
+ state.write(`<Prompt${propsStr}${extraAttrsPropString(node.attrs)}>`);
4410
+ if (rawChildren) {
4411
+ state.ensureNewLine();
4412
+ state.write(rawChildren);
4413
+ }
4414
+ state.ensureNewLine();
4415
+ state.write("</Prompt>");
4416
+ state.closeBlock();
4431
4417
  }
4432
- function renderTextNode(state, node) {
4433
- const text = node.text || "";
4434
- if (!text)
4435
- return;
4436
- const marks2 = serializableMarks(node.marks);
4437
- let openMarks = "";
4438
- let closeMarks = "";
4439
- for (const mark of marks2) {
4440
- const { open, close } = getMarkStrings(mark);
4441
- openMarks += open;
4442
- closeMarks = close + closeMarks;
4418
+ function serializeColorItemTag(item) {
4419
+ const parts = [];
4420
+ if (item.name) {
4421
+ const nameProp = serializeJsxAttribute({}, "name", item.name);
4422
+ if (nameProp)
4423
+ parts.push(nameProp);
4443
4424
  }
4444
- if (marks2.length > 0) {
4445
- let innerText = text;
4446
- let leadingSpace = "";
4447
- let trailingSpace = "";
4448
- if (marks2.some(usesFlanking)) {
4449
- const leadingMatch = innerText.match(/^( +)/);
4450
- if (leadingMatch) {
4451
- leadingSpace = leadingMatch[0];
4452
- innerText = innerText.slice(leadingSpace.length);
4453
- }
4454
- const trailingMatch = innerText.match(/( +)$/);
4455
- if (trailingMatch) {
4456
- trailingSpace = trailingMatch[0];
4457
- innerText = innerText.slice(0, -trailingSpace.length);
4458
- }
4459
- if (!innerText) {
4460
- state.text(text);
4461
- return;
4425
+ if (item.rawValueExpr !== void 0) {
4426
+ parts.push(`value={${item.rawValueExpr}}`);
4427
+ } else if (item.value !== void 0 && item.value !== null) {
4428
+ const valueProp = serializeJsxAttribute({}, "value", item.value);
4429
+ if (valueProp)
4430
+ parts.push(valueProp);
4431
+ }
4432
+ return `<Color.Item${parts.length ? " " + parts.join(" ") : ""} />`;
4433
+ }
4434
+ function renderColor(state, node) {
4435
+ var _a;
4436
+ const variant = node.attrs.variant;
4437
+ const colorData = (_a = node.attrs.colorData) !== null && _a !== void 0 ? _a : [];
4438
+ const variantProp = variant ? ` variant="${variant}"` : "";
4439
+ state.write(`<Color${variantProp}${extraAttrsPropString(node.attrs)}>`);
4440
+ state.ensureNewLine();
4441
+ const prevDelim = state.delim;
4442
+ state.delim += " ".repeat(state.indentSize);
4443
+ for (const child of colorData) {
4444
+ if (child.type === "row") {
4445
+ const titleProp = child.title ? serializeJsxAttribute({}, "title", child.title) : null;
4446
+ state.write(`<Color.Row${titleProp ? ` ${titleProp}` : ""}>`);
4447
+ state.ensureNewLine();
4448
+ const rowPrevDelim = state.delim;
4449
+ state.delim += " ".repeat(state.indentSize);
4450
+ for (const item of child.items) {
4451
+ state.write(serializeColorItemTag(item));
4452
+ state.ensureNewLine();
4462
4453
  }
4454
+ state.delim = rowPrevDelim;
4455
+ state.closed = false;
4456
+ state.ensureNewLine();
4457
+ state.write("</Color.Row>");
4458
+ state.ensureNewLine();
4459
+ } else {
4460
+ state.write(serializeColorItemTag(child));
4461
+ state.ensureNewLine();
4463
4462
  }
4464
- if (leadingSpace)
4465
- state.write(leadingSpace);
4466
- state.write(openMarks);
4467
- state.write(marks2.some((m) => m.type.name === "code") ? state.escCodeText(innerText) : state.esc(innerText, { inLinkText: marks2.some((m) => m.type.name === "link") }));
4468
- state.write(closeMarks);
4469
- if (trailingSpace)
4470
- state.write(trailingSpace);
4471
- } else {
4472
- state.text(text);
4473
4463
  }
4464
+ state.delim = prevDelim;
4465
+ state.closed = false;
4466
+ state.ensureNewLine();
4467
+ state.write("</Color>");
4468
+ state.closeBlock();
4474
4469
  }
4475
- function escapeReferenceLabel(label) {
4476
- return label.replace(/\\(?=[\u0021-\u002F\u003A-\u0040\u005B-\u0060\u007B-\u007E]|$)/g, "\\\\").replace(/[\[\]]/g, "\\$&");
4470
+ function serializeTreeChildAttrs(attrs2) {
4471
+ const parts = [];
4472
+ for (const [key, value] of Object.entries(attrs2)) {
4473
+ if (value === void 0)
4474
+ continue;
4475
+ const prop = serializeJsxAttribute({}, key, value);
4476
+ if (prop)
4477
+ parts.push(prop);
4478
+ }
4479
+ return parts.length ? " " + parts.join(" ") : "";
4477
4480
  }
4478
- function getMarkStrings(mark) {
4479
- switch (mark.type.name) {
4480
- case "bold":
4481
- return { open: "**", close: "**" };
4482
- case "italic":
4483
- return { open: "_", close: "_" };
4484
- case "strike":
4485
- return { open: "~~", close: "~~" };
4486
- case "code":
4487
- return { open: "`", close: "`" };
4488
- case "link": {
4489
- const componentLink = getLinkComponentMarkStrings(mark);
4490
- if (componentLink)
4491
- return componentLink;
4492
- const referenceLabel = mark.attrs.referenceLabel;
4493
- if (typeof referenceLabel === "string" && referenceLabel) {
4494
- return { open: "[", close: `][${escapeReferenceLabel(referenceLabel)}]` };
4495
- }
4496
- const href = mark.attrs.href || "";
4497
- const title = mark.attrs.title;
4498
- const titleStr = title ? ` "${title}"` : "";
4499
- return {
4500
- open: "[",
4501
- close: `](${href.replace(/[()]/g, "\\$&")}${titleStr})`
4502
- };
4503
- }
4504
- case "underline":
4505
- return { open: "<u>", close: "</u>" };
4506
- case "subscript":
4507
- return { open: "<sub>", close: "</sub>" };
4508
- case "superscript":
4509
- return { open: "<sup>", close: "</sup>" };
4510
- case "kbd":
4511
- return { open: "<kbd>", close: "</kbd>" };
4512
- default:
4513
- return { open: "", close: "" };
4481
+ function writeTreeChild(state, child) {
4482
+ if (child.type === "file") {
4483
+ const attrStr2 = serializeTreeChildAttrs({ name: child.name });
4484
+ state.write(`<Tree.File${attrStr2} />`);
4485
+ state.ensureNewLine();
4486
+ return;
4487
+ }
4488
+ const attrStr = serializeTreeChildAttrs({
4489
+ name: child.name,
4490
+ defaultOpen: child.defaultOpen,
4491
+ openable: child.openable
4492
+ });
4493
+ if (child.children.length === 0) {
4494
+ state.write(`<Tree.Folder${attrStr} />`);
4495
+ state.ensureNewLine();
4496
+ return;
4497
+ }
4498
+ state.write(`<Tree.Folder${attrStr}>`);
4499
+ state.ensureNewLine();
4500
+ const prevDelim = state.delim;
4501
+ state.delim += " ".repeat(state.indentSize);
4502
+ for (const grandchild of child.children) {
4503
+ writeTreeChild(state, grandchild);
4514
4504
  }
4505
+ state.delim = prevDelim;
4506
+ state.closed = false;
4507
+ state.ensureNewLine();
4508
+ state.write("</Tree.Folder>");
4509
+ state.ensureNewLine();
4515
4510
  }
4516
- function getLinkComponentMarkStrings(mark) {
4517
- const storedAttributes = mark.attrs.mdxLinkAttributes;
4518
- const href = mark.attrs.href;
4519
- if (!isAttributeRecord3(storedAttributes) || typeof href !== "string")
4520
- return void 0;
4521
- const attributes = Object.assign(Object.assign({}, storedAttributes), { href });
4522
- if (mark.attrs.title === null || mark.attrs.title === void 0) {
4523
- delete attributes.title;
4524
- } else {
4525
- attributes.title = mark.attrs.title;
4511
+ function renderTree(state, node) {
4512
+ var _a;
4513
+ const treeData = (_a = node.attrs.treeData) !== null && _a !== void 0 ? _a : [];
4514
+ const extraTreeAttrs = extraAttrsPropString(node.attrs);
4515
+ if (treeData.length === 0) {
4516
+ state.write(`<Tree${extraTreeAttrs} />`);
4517
+ state.closeBlock();
4518
+ return;
4526
4519
  }
4527
- const namedAttributes = Object.entries(attributes).filter(([key]) => key !== NAMED_EXPRESSION_ATTRS_KEY).map(([key, value]) => serializeJsxAttribute(attributes, key, value)).filter((attribute) => attribute !== null);
4528
- const serializedAttributes = namedAttributes.join(" ");
4529
- return {
4530
- open: `<Link${serializedAttributes ? ` ${serializedAttributes}` : ""}>`,
4531
- close: "</Link>"
4532
- };
4520
+ state.write(`<Tree${extraTreeAttrs}>`);
4521
+ state.ensureNewLine();
4522
+ const prevDelim = state.delim;
4523
+ state.delim += " ".repeat(state.indentSize);
4524
+ for (const child of treeData) {
4525
+ writeTreeChild(state, child);
4526
+ }
4527
+ state.delim = prevDelim;
4528
+ state.closed = false;
4529
+ state.ensureNewLine();
4530
+ state.write("</Tree>");
4531
+ state.closeBlock();
4533
4532
  }
4534
- function isAttributeRecord3(value) {
4535
- return typeof value === "object" && value !== null && !Array.isArray(value);
4533
+ function getExpressionAttrStrings(attrs2) {
4534
+ const raw = attrs2[EXPRESSION_ATTRS_KEY];
4535
+ if (!Array.isArray(raw))
4536
+ return [];
4537
+ return raw.map((v) => `{${v}}`);
4538
+ }
4539
+ function mergeExtraAttrs(attrs2) {
4540
+ const extra = attrs2[EXTRA_ATTRS_KEY];
4541
+ if (!extra || typeof extra !== "object")
4542
+ return attrs2;
4543
+ return Object.assign(Object.assign({}, attrs2), extra);
4544
+ }
4545
+ function extraAttrsPropString(nodeAttrs) {
4546
+ const extra = nodeAttrs[EXTRA_ATTRS_KEY];
4547
+ if (!extra || typeof extra !== "object")
4548
+ return "";
4549
+ const entries = Object.entries(extra);
4550
+ if (entries.length === 0)
4551
+ return "";
4552
+ const props = entries.map(([key, value]) => serializeJsxAttribute(extra, key, value)).filter(Boolean);
4553
+ return props.length > 0 ? " " + props.join(" ") : "";
4536
4554
  }
4537
4555
 
4538
4556
  // ../editor/dist/converter/serialize/pm-to-mdx.js
@@ -4589,6 +4607,7 @@ var BLOCK_LINE_TYPES = /* @__PURE__ */ new Set([
4589
4607
  BLOCK_TYPES.visibility
4590
4608
  ]);
4591
4609
  var LAZY_CONTINUATION_TYPES = /* @__PURE__ */ new Set(["blockquote", "bulletList", "orderedList"]);
4610
+ var IMAGE_TYPES = /* @__PURE__ */ new Set(["image", BLOCK_TYPES.image]);
4592
4611
  var REFERENCE_DEFINITION_TYPES = /* @__PURE__ */ new Set(["definition", "footnoteDefinition"]);
4593
4612
  function hasReferenceDefinitions(doc) {
4594
4613
  let found = false;
@@ -4670,6 +4689,8 @@ function continuesLazily(previous, current) {
4670
4689
  return false;
4671
4690
  if (previous.type.name === "paragraph")
4672
4691
  return isNonEmptyParagraph(previous);
4692
+ if (IMAGE_TYPES.has(previous.type.name))
4693
+ return isMarkdownImage(previous);
4673
4694
  if (previous.type.name === "table")
4674
4695
  return isPipeTable(previous);
4675
4696
  return LAZY_CONTINUATION_TYPES.has(previous.type.name);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mintlify/cli",
3
- "version": "4.0.1549",
3
+ "version": "4.0.1550",
4
4
  "description": "The Mintlify CLI",
5
5
  "engines": {
6
6
  "node": ">=18.0.0"
@@ -86,7 +86,7 @@
86
86
  "keytar": "7.9.0"
87
87
  },
88
88
  "devDependencies": {
89
- "@mintlify/editor": "0.0.430",
89
+ "@mintlify/editor": "0.0.431",
90
90
  "@mintlify/ts-config": "2.0.2",
91
91
  "@tsconfig/recommended": "1.0.2",
92
92
  "@types/detect-port": "1.3.2",
@@ -105,5 +105,5 @@
105
105
  "vitest": "2.1.9",
106
106
  "vitest-mock-process": "1.0.4"
107
107
  },
108
- "gitHead": "6ae8b7a7eb3e0b3d0d2f9df1b637cbf09442b6bf"
108
+ "gitHead": "5446ccd3016de4278d825ed4088433b4cd40647b"
109
109
  }