@mintlify/cli 4.0.1536 → 4.0.1537

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.
@@ -1572,7 +1572,7 @@ function handleFlowJsxInner(node, ctx, transformNode2, mapJsxChildren2) {
1572
1572
  content: withRequiredContent(targetType, mapJsxChildren2(node, ctx))
1573
1573
  };
1574
1574
  }
1575
- if (node.name === "table" && !hasSpannedCell(node) && !hasTableClass(node)) {
1575
+ if (node.name === "table" && !hasSpannedCell(node) && !hasTableClass(node) && !hasNonPipeTableSection(node)) {
1576
1576
  return handleHtmlTable(node, ctx, transformNode2, mapJsxChildren2);
1577
1577
  }
1578
1578
  if (HTML_ELEMENTS.has(node.name)) {
@@ -1821,6 +1821,9 @@ var TABLE_CLASS_ATTRS = /* @__PURE__ */ new Set(["class", "className"]);
1821
1821
  function hasTableClass(node) {
1822
1822
  return node.attributes.some((a) => a.type === "mdxJsxAttribute" && TABLE_CLASS_ATTRS.has(a.name));
1823
1823
  }
1824
+ function hasNonPipeTableSection(node) {
1825
+ return unwrapParagraphs(node.children).some((child) => (child.type === "mdxJsxFlowElement" || child.type === "mdxJsxTextElement") && (child.name === "tfoot" || child.name === "caption" || child.name === "thead" && collectJsxElementsNamed(child.children, "tr").length > 1));
1826
+ }
1824
1827
  function hasSpannedCell(node) {
1825
1828
  if (isTableCellJsxNode(node) && node.attributes.some((a) => a.type === "mdxJsxAttribute" && CELL_SPAN_ATTRS.has(a.name))) {
1826
1829
  return true;
@@ -1829,25 +1832,11 @@ function hasSpannedCell(node) {
1829
1832
  }
1830
1833
  function handleHtmlTable(node, ctx, transformNode2, mapJsxChildren2) {
1831
1834
  const rows = [];
1832
- for (const child of node.children) {
1835
+ for (const child of unwrapParagraphs(node.children)) {
1833
1836
  if (isTableRowJsxNode(child)) {
1834
1837
  rows.push(child);
1835
- } else if (child.type === "paragraph") {
1836
- for (const paragraphChild of child.children) {
1837
- if (isTableRowJsxNode(paragraphChild))
1838
- rows.push(paragraphChild);
1839
- }
1840
- } else if (child.type === "mdxJsxFlowElement" && (child.name === "tbody" || child.name === "thead")) {
1841
- for (const rowChild of child.children) {
1842
- if (isTableRowJsxNode(rowChild)) {
1843
- rows.push(rowChild);
1844
- } else if (rowChild.type === "paragraph") {
1845
- for (const paragraphChild of rowChild.children) {
1846
- if (isTableRowJsxNode(paragraphChild))
1847
- rows.push(paragraphChild);
1848
- }
1849
- }
1850
- }
1838
+ } else if (isJsxElementNamed(child, "thead") || isJsxElementNamed(child, "tbody")) {
1839
+ rows.push(...unwrapParagraphs(child.children).filter(isTableRowJsxNode));
1851
1840
  }
1852
1841
  }
1853
1842
  if (rows.length === 0) {
@@ -1880,19 +1869,11 @@ function handleHtmlTable(node, ctx, transformNode2, mapJsxChildren2) {
1880
1869
  function isJsxElementNamed(node, name) {
1881
1870
  return (node.type === "mdxJsxFlowElement" || node.type === "mdxJsxTextElement") && node.name === name;
1882
1871
  }
1872
+ function unwrapParagraphs(children) {
1873
+ return children.flatMap((child) => child.type === "paragraph" ? child.children : [child]);
1874
+ }
1883
1875
  function collectJsxElementsNamed(children, name) {
1884
- const found = [];
1885
- for (const child of children) {
1886
- if (isJsxElementNamed(child, name)) {
1887
- found.push(child);
1888
- } else if (child.type === "paragraph") {
1889
- for (const paragraphChild of child.children) {
1890
- if (isJsxElementNamed(paragraphChild, name))
1891
- found.push(paragraphChild);
1892
- }
1893
- }
1894
- }
1895
- return found;
1876
+ return unwrapParagraphs(children).filter((child) => isJsxElementNamed(child, name));
1896
1877
  }
1897
1878
  function parseColWidth(col) {
1898
1879
  var _a, _b;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mintlify/cli",
3
- "version": "4.0.1536",
3
+ "version": "4.0.1537",
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.417",
89
+ "@mintlify/editor": "0.0.418",
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": "a0d6ff54b5c13f5e17cbb316bebf95ac66d8c3a4"
108
+ "gitHead": "c450524be3f804775e3d06e5c8d74157524b53f6"
109
109
  }