@mintlify/cli 4.0.1449 → 4.0.1451

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.
@@ -1596,7 +1596,7 @@ function handleFlowJsxInner(node, ctx, transformNode2, mapJsxChildren2) {
1596
1596
  if (node.name === BLOCK_TYPES.tree) {
1597
1597
  return handleTree(node);
1598
1598
  }
1599
- if (isCallout || Object.values(BLOCK_TYPES).includes(node.name)) {
1599
+ if (isCallout || node.name !== BLOCK_TYPES.step && Object.values(BLOCK_TYPES).includes(node.name)) {
1600
1600
  const targetType = isCallout ? BLOCK_TYPES.callout : node.name;
1601
1601
  const parsedAttrs = parseMdxAttributes(node.attributes);
1602
1602
  return {
@@ -1970,7 +1970,7 @@ function mapTableJsxElementChildren(node, ctx, transformNode2, mapJsxChildren2)
1970
1970
 
1971
1971
  // ../editor/dist/converter/parse/handlers/inline-jsx.js
1972
1972
  function handleInlineJsx(node, ctx, mapChildren2) {
1973
- var _a;
1973
+ var _a, _b;
1974
1974
  if (node.name === "Tooltip") {
1975
1975
  const attrs2 = partitionAttrs(parseMdxAttributes(node.attributes), TOOLTIP_ATTRS);
1976
1976
  const content = mapChildren2(node, ctx);
@@ -2033,14 +2033,17 @@ function handleInlineJsx(node, ctx, mapChildren2) {
2033
2033
  };
2034
2034
  }
2035
2035
  if (node.name && HTML_ELEMENTS.has(node.name)) {
2036
+ const schema2 = (_b = ctx.schema) !== null && _b !== void 0 ? _b : mintlifySchema;
2037
+ const children = mapChildren2(node, ctx);
2038
+ const hasBlock = children.some((child) => !isInlineNode(child, schema2));
2036
2039
  return {
2037
- type: BLOCK_TYPES.inlineStaticHTML,
2040
+ type: hasBlock ? BLOCK_TYPES.staticHTML : BLOCK_TYPES.inlineStaticHTML,
2038
2041
  attrs: {
2039
2042
  tagName: node.name,
2040
2043
  attributes: parseMdxAttributes(node.attributes),
2041
2044
  mdxJsxNode: node
2042
2045
  },
2043
- content: mapChildren2(node, ctx)
2046
+ content: hasBlock ? normalizeBlockContent(children, schema2) : children
2044
2047
  };
2045
2048
  }
2046
2049
  if (node.name) {
@@ -2368,14 +2371,14 @@ function buildMarkdownTableCellContent(children, ctx, transformNode2) {
2368
2371
  return children.flatMap((child) => flattenNodeContent(transformNode2(child, ctx)));
2369
2372
  }
2370
2373
  function handleParagraph(node, ctx, transformNode2, mapChildren2) {
2371
- var _a, _b, _c;
2374
+ var _a, _b, _c, _d;
2372
2375
  if (node.children.length === 1 && ((_a = node.children[0]) === null || _a === void 0 ? void 0 : _a.type) === "mdxJsxTextElement" && ((_b = node.children[0]) === null || _b === void 0 ? void 0 : _b.name)) {
2373
2376
  const result = transformNode2(node.children[0], ctx);
2374
2377
  const nodes2 = flattenNodeContent(result);
2375
- const schema2 = (_c = ctx.schema) !== null && _c !== void 0 ? _c : mintlifySchema;
2378
+ const schema3 = (_c = ctx.schema) !== null && _c !== void 0 ? _c : mintlifySchema;
2376
2379
  const allInline = nodes2.length > 0 && nodes2.every((child) => {
2377
2380
  var _a2;
2378
- return ((_a2 = schema2.nodes[child.type]) === null || _a2 === void 0 ? void 0 : _a2.isInline) === true;
2381
+ return ((_a2 = schema3.nodes[child.type]) === null || _a2 === void 0 ? void 0 : _a2.isInline) === true;
2379
2382
  });
2380
2383
  if (allInline) {
2381
2384
  return { type: "paragraph", content: nodes2 };
@@ -2386,22 +2389,22 @@ function handleParagraph(node, ctx, transformNode2, mapChildren2) {
2386
2389
  if (hasImages) {
2387
2390
  const hasTextContent = node.children.some((child) => child.type === "text" || child.type === "emphasis" || child.type === "strong" || child.type === "link" || child.type === "inlineCode" || child.type === "delete" || child.type === "mdxJsxTextElement" && child.name !== "img");
2388
2391
  if (hasTextContent) {
2389
- const content = [];
2392
+ const content2 = [];
2390
2393
  for (const child of node.children) {
2391
2394
  if (child.type === "image" || child.type === "mdxJsxTextElement" && child.name === "img") {
2392
2395
  const inlineImg = convertToInlineImage(child);
2393
2396
  if (inlineImg)
2394
- content.push(inlineImg);
2397
+ content2.push(inlineImg);
2395
2398
  } else {
2396
2399
  const result = transformNode2(child, ctx);
2397
2400
  if (Array.isArray(result)) {
2398
- content.push(...result);
2401
+ content2.push(...result);
2399
2402
  } else {
2400
- content.push(result);
2403
+ content2.push(result);
2401
2404
  }
2402
2405
  }
2403
2406
  }
2404
- return { type: "paragraph", content: content.filter(Boolean) };
2407
+ return { type: "paragraph", content: content2.filter(Boolean) };
2405
2408
  }
2406
2409
  const blocks = [];
2407
2410
  for (const child of node.children) {
@@ -2415,10 +2418,32 @@ function handleParagraph(node, ctx, transformNode2, mapChildren2) {
2415
2418
  }
2416
2419
  return blocks.length > 0 ? blocks : [];
2417
2420
  }
2418
- return {
2419
- type: "paragraph",
2420
- content: mapChildren2(node, ctx)
2421
- };
2421
+ const content = mapChildren2(node, ctx);
2422
+ const schema2 = (_d = ctx.schema) !== null && _d !== void 0 ? _d : mintlifySchema;
2423
+ if (content.every((child) => isInlineNode(child, schema2))) {
2424
+ return { type: "paragraph", content };
2425
+ }
2426
+ return splitParagraphAroundBlocks(content, schema2);
2427
+ }
2428
+ function splitParagraphAroundBlocks(content, schema2) {
2429
+ return normalizeBlockContent(mergeDarkLightImagePairs(content), schema2).map((block) => block.type === "paragraph" ? trimParagraph(block) : block).filter((block) => {
2430
+ var _a, _b;
2431
+ return block.type !== "paragraph" || ((_b = (_a = block.content) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) > 0;
2432
+ });
2433
+ }
2434
+ function trimParagraph(paragraph) {
2435
+ var _a;
2436
+ const content = [...(_a = paragraph.content) !== null && _a !== void 0 ? _a : []];
2437
+ const first = content[0];
2438
+ if ((first === null || first === void 0 ? void 0 : first.type) === "text" && first.text) {
2439
+ content[0] = Object.assign(Object.assign({}, first), { text: first.text.replace(/^\s+/, "") });
2440
+ }
2441
+ const lastIndex = content.length - 1;
2442
+ const last = content[lastIndex];
2443
+ if ((last === null || last === void 0 ? void 0 : last.type) === "text" && last.text) {
2444
+ content[lastIndex] = Object.assign(Object.assign({}, last), { text: last.text.replace(/\s+$/, "") });
2445
+ }
2446
+ return Object.assign(Object.assign({}, paragraph), { content: content.filter((n) => n.type !== "text" || n.text !== "") });
2422
2447
  }
2423
2448
  function handleTable(node, ctx, transformNode2) {
2424
2449
  const rows = node.children;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mintlify/cli",
3
- "version": "4.0.1449",
3
+ "version": "4.0.1451",
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.339",
89
+ "@mintlify/editor": "0.0.341",
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": "3841674841fd67559df5b42dbacd7f1b1d7955b4"
108
+ "gitHead": "925ab331e0ad099cdb73ae5876409bcdcdab5db2"
109
109
  }