@tinacms/mdx 0.0.0-c8b1d84-20241003015733 → 0.0.0-d524599-20241115065930

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.
@@ -21712,10 +21712,14 @@ function peekDelete() {
21712
21712
  return "~";
21713
21713
  }
21714
21714
 
21715
- // ../../../node_modules/.pnpm/markdown-table@3.0.3/node_modules/markdown-table/index.js
21716
- function markdownTable(table, options = {}) {
21717
- const align = (options.align || []).concat();
21718
- const stringLength = options.stringLength || defaultStringLength;
21715
+ // ../../../node_modules/.pnpm/markdown-table@3.0.4/node_modules/markdown-table/index.js
21716
+ function defaultStringLength(value) {
21717
+ return value.length;
21718
+ }
21719
+ function markdownTable(table, options) {
21720
+ const settings = options || {};
21721
+ const align = (settings.align || []).concat();
21722
+ const stringLength = settings.stringLength || defaultStringLength;
21719
21723
  const alignments = [];
21720
21724
  const cellMatrix = [];
21721
21725
  const sizeMatrix = [];
@@ -21731,7 +21735,7 @@ function markdownTable(table, options = {}) {
21731
21735
  }
21732
21736
  while (++columnIndex2 < table[rowIndex].length) {
21733
21737
  const cell = serialize(table[rowIndex][columnIndex2]);
21734
- if (options.alignDelimiters !== false) {
21738
+ if (settings.alignDelimiters !== false) {
21735
21739
  const size = stringLength(cell);
21736
21740
  sizes2[columnIndex2] = size;
21737
21741
  if (longestCellByColumn[columnIndex2] === void 0 || size > longestCellByColumn[columnIndex2]) {
@@ -21769,12 +21773,12 @@ function markdownTable(table, options = {}) {
21769
21773
  } else if (code3 === 114) {
21770
21774
  after = ":";
21771
21775
  }
21772
- let size = options.alignDelimiters === false ? 1 : Math.max(
21776
+ let size = settings.alignDelimiters === false ? 1 : Math.max(
21773
21777
  1,
21774
21778
  longestCellByColumn[columnIndex] - before.length - after.length
21775
21779
  );
21776
21780
  const cell = before + "-".repeat(size) + after;
21777
- if (options.alignDelimiters !== false) {
21781
+ if (settings.alignDelimiters !== false) {
21778
21782
  size = before.length + size + after.length;
21779
21783
  if (size > longestCellByColumn[columnIndex]) {
21780
21784
  longestCellByColumn[columnIndex] = size;
@@ -21796,7 +21800,7 @@ function markdownTable(table, options = {}) {
21796
21800
  const cell = row2[columnIndex] || "";
21797
21801
  let before = "";
21798
21802
  let after = "";
21799
- if (options.alignDelimiters !== false) {
21803
+ if (settings.alignDelimiters !== false) {
21800
21804
  const size = longestCellByColumn[columnIndex] - (sizes2[columnIndex] || 0);
21801
21805
  const code3 = alignments[columnIndex];
21802
21806
  if (code3 === 114) {
@@ -21813,28 +21817,28 @@ function markdownTable(table, options = {}) {
21813
21817
  after = " ".repeat(size);
21814
21818
  }
21815
21819
  }
21816
- if (options.delimiterStart !== false && !columnIndex) {
21820
+ if (settings.delimiterStart !== false && !columnIndex) {
21817
21821
  line2.push("|");
21818
21822
  }
21819
- if (options.padding !== false && !(options.alignDelimiters === false && cell === "") && (options.delimiterStart !== false || columnIndex)) {
21823
+ if (settings.padding !== false && !(settings.alignDelimiters === false && cell === "") && (settings.delimiterStart !== false || columnIndex)) {
21820
21824
  line2.push(" ");
21821
21825
  }
21822
- if (options.alignDelimiters !== false) {
21826
+ if (settings.alignDelimiters !== false) {
21823
21827
  line2.push(before);
21824
21828
  }
21825
21829
  line2.push(cell);
21826
- if (options.alignDelimiters !== false) {
21830
+ if (settings.alignDelimiters !== false) {
21827
21831
  line2.push(after);
21828
21832
  }
21829
- if (options.padding !== false) {
21833
+ if (settings.padding !== false) {
21830
21834
  line2.push(" ");
21831
21835
  }
21832
- if (options.delimiterEnd !== false || columnIndex !== mostCellsPerRow - 1) {
21836
+ if (settings.delimiterEnd !== false || columnIndex !== mostCellsPerRow - 1) {
21833
21837
  line2.push("|");
21834
21838
  }
21835
21839
  }
21836
21840
  lines2.push(
21837
- options.delimiterEnd === false ? line2.join("").replace(/ +$/, "") : line2.join("")
21841
+ settings.delimiterEnd === false ? line2.join("").replace(/ +$/, "") : line2.join("")
21838
21842
  );
21839
21843
  }
21840
21844
  return lines2.join("\n");
@@ -21842,9 +21846,6 @@ function markdownTable(table, options = {}) {
21842
21846
  function serialize(value) {
21843
21847
  return value === null || value === void 0 ? "" : String(value);
21844
21848
  }
21845
- function defaultStringLength(value) {
21846
- return value.length;
21847
- }
21848
21849
  function toAlignment(value) {
21849
21850
  const code3 = typeof value === "string" ? value.codePointAt(0) : 0;
21850
21851
  return code3 === 67 || code3 === 99 ? 99 : code3 === 76 || code3 === 108 ? 108 : code3 === 82 || code3 === 114 ? 114 : 0;
@@ -38861,6 +38862,12 @@ var blockElement = (content3, field, imageCallback) => {
38861
38862
  type: "paragraph",
38862
38863
  children: eat2(content3.children, field, imageCallback)
38863
38864
  };
38865
+ case "mermaid":
38866
+ return {
38867
+ type: "code",
38868
+ lang: "mermaid",
38869
+ value: content3.value
38870
+ };
38864
38871
  case "code_block":
38865
38872
  return {
38866
38873
  type: "code",
@@ -38869,11 +38876,11 @@ var blockElement = (content3, field, imageCallback) => {
38869
38876
  };
38870
38877
  case "mdxJsxFlowElement":
38871
38878
  if (content3.name === "table") {
38872
- const table = content3.props;
38879
+ const table2 = content3.props;
38873
38880
  return {
38874
38881
  type: "table",
38875
- align: table.align,
38876
- children: table.tableRows.map((tableRow) => {
38882
+ align: table2.align,
38883
+ children: table2.tableRows.map((tableRow) => {
38877
38884
  const tr2 = {
38878
38885
  type: "tableRow",
38879
38886
  children: tableRow.tableCells.map(({ value }) => {
@@ -38969,6 +38976,27 @@ var blockElement = (content3, field, imageCallback) => {
38969
38976
  }
38970
38977
  ]
38971
38978
  };
38979
+ case "table":
38980
+ const table = content3.props;
38981
+ return {
38982
+ type: "table",
38983
+ align: table?.align,
38984
+ children: content3.children.map((tableRow) => {
38985
+ return {
38986
+ type: "tableRow",
38987
+ children: tableRow.children.map((tableCell) => {
38988
+ return {
38989
+ type: "tableCell",
38990
+ children: eat2(
38991
+ tableCell.children?.at(0)?.children || [],
38992
+ field,
38993
+ imageCallback
38994
+ )
38995
+ };
38996
+ })
38997
+ };
38998
+ })
38999
+ };
38972
39000
  default:
38973
39001
  throw new Error(`BlockElement: ${content3.type} is not yet supported`);
38974
39002
  }
@@ -39531,6 +39559,12 @@ var blockElement2 = (content3, field, imageCallback) => {
39531
39559
  type: "paragraph",
39532
39560
  children: eat3(content3.children, field, imageCallback)
39533
39561
  };
39562
+ case "mermaid":
39563
+ return {
39564
+ type: "code",
39565
+ lang: "mermaid",
39566
+ value: content3.value
39567
+ };
39534
39568
  case "code_block":
39535
39569
  return {
39536
39570
  type: "code",
@@ -39539,11 +39573,11 @@ var blockElement2 = (content3, field, imageCallback) => {
39539
39573
  };
39540
39574
  case "mdxJsxFlowElement":
39541
39575
  if (content3.name === "table") {
39542
- const table = content3.props;
39576
+ const table2 = content3.props;
39543
39577
  return {
39544
39578
  type: "table",
39545
- align: table.align,
39546
- children: table.tableRows.map((tableRow) => {
39579
+ align: table2.align,
39580
+ children: table2.tableRows.map((tableRow) => {
39547
39581
  const tr2 = {
39548
39582
  type: "tableRow",
39549
39583
  children: tableRow.tableCells.map(({ value }) => {
@@ -39610,6 +39644,27 @@ var blockElement2 = (content3, field, imageCallback) => {
39610
39644
  }
39611
39645
  ]
39612
39646
  };
39647
+ case "table":
39648
+ const table = content3.props;
39649
+ return {
39650
+ type: "table",
39651
+ align: table?.align,
39652
+ children: content3.children.map((tableRow) => {
39653
+ return {
39654
+ type: "tableRow",
39655
+ children: tableRow.children.map((tableCell) => {
39656
+ return {
39657
+ type: "tableCell",
39658
+ children: eat3(
39659
+ tableCell.children?.at(0)?.children || [],
39660
+ field,
39661
+ imageCallback
39662
+ )
39663
+ };
39664
+ })
39665
+ };
39666
+ })
39667
+ };
39613
39668
  default:
39614
39669
  throw new Error(`BlockElement: ${content3.type} is not yet supported`);
39615
39670
  }
@@ -42043,32 +42098,29 @@ var remarkToSlate = (root2, field, imageCallback, raw, skipMDXProcess) => {
42043
42098
  switch (content4.type) {
42044
42099
  case "table": {
42045
42100
  return {
42046
- type: "mdxJsxFlowElement",
42047
- children: [{ type: "text", text: "" }],
42048
- name: "table",
42049
- props: {
42050
- align: content4.align?.filter((item) => !!item),
42051
- tableRows: content4.children.map((child) => {
42052
- return {
42053
- tableCells: child.children.map((child2) => {
42054
- return {
42055
- value: {
42056
- type: "root",
42057
- children: [
42058
- {
42059
- type: "p",
42060
- children: (0, import_lodash.default)(
42061
- child2.children.map(
42062
- (child3) => phrasingContent(child3)
42063
- )
42064
- )
42065
- }
42066
- ]
42101
+ type: "table",
42102
+ children: content4.children.map((tableRow) => {
42103
+ return {
42104
+ type: "tr",
42105
+ children: tableRow.children.map((tableCell) => {
42106
+ return {
42107
+ type: "td",
42108
+ children: [
42109
+ {
42110
+ type: "p",
42111
+ children: (0, import_lodash.default)(
42112
+ tableCell.children.map(
42113
+ (child) => phrasingContent(child)
42114
+ )
42115
+ )
42067
42116
  }
42068
- };
42069
- })
42070
- };
42071
- })
42117
+ ]
42118
+ };
42119
+ })
42120
+ };
42121
+ }),
42122
+ props: {
42123
+ align: content4.align?.filter((item) => !!item)
42072
42124
  }
42073
42125
  };
42074
42126
  }
@@ -42087,7 +42139,7 @@ var remarkToSlate = (root2, field, imageCallback, raw, skipMDXProcess) => {
42087
42139
  case "heading":
42088
42140
  return heading2(content4);
42089
42141
  case "code":
42090
- return code3(content4);
42142
+ return parseCode(content4);
42091
42143
  case "paragraph":
42092
42144
  return paragraph2(content4);
42093
42145
  case "mdxJsxFlowElement":
@@ -42234,6 +42286,19 @@ var remarkToSlate = (root2, field, imageCallback, raw, skipMDXProcess) => {
42234
42286
  );
42235
42287
  }
42236
42288
  };
42289
+ const parseCode = (content4) => {
42290
+ if (content4.lang === "mermaid") {
42291
+ return mermaid(content4);
42292
+ }
42293
+ return code3(content4);
42294
+ };
42295
+ const mermaid = (content4) => {
42296
+ return {
42297
+ type: "mermaid",
42298
+ value: content4.value,
42299
+ children: [{ type: "text", text: "" }]
42300
+ };
42301
+ };
42237
42302
  const code3 = (content4) => {
42238
42303
  const extra = {};
42239
42304
  if (content4.lang)
package/dist/index.js CHANGED
@@ -23589,10 +23589,14 @@ function peekDelete() {
23589
23589
  return "~";
23590
23590
  }
23591
23591
 
23592
- // ../../../node_modules/.pnpm/markdown-table@3.0.3/node_modules/markdown-table/index.js
23593
- function markdownTable(table, options = {}) {
23594
- const align = (options.align || []).concat();
23595
- const stringLength = options.stringLength || defaultStringLength;
23592
+ // ../../../node_modules/.pnpm/markdown-table@3.0.4/node_modules/markdown-table/index.js
23593
+ function defaultStringLength(value) {
23594
+ return value.length;
23595
+ }
23596
+ function markdownTable(table, options) {
23597
+ const settings = options || {};
23598
+ const align = (settings.align || []).concat();
23599
+ const stringLength = settings.stringLength || defaultStringLength;
23596
23600
  const alignments = [];
23597
23601
  const cellMatrix = [];
23598
23602
  const sizeMatrix = [];
@@ -23608,7 +23612,7 @@ function markdownTable(table, options = {}) {
23608
23612
  }
23609
23613
  while (++columnIndex2 < table[rowIndex].length) {
23610
23614
  const cell = serialize(table[rowIndex][columnIndex2]);
23611
- if (options.alignDelimiters !== false) {
23615
+ if (settings.alignDelimiters !== false) {
23612
23616
  const size = stringLength(cell);
23613
23617
  sizes2[columnIndex2] = size;
23614
23618
  if (longestCellByColumn[columnIndex2] === void 0 || size > longestCellByColumn[columnIndex2]) {
@@ -23646,12 +23650,12 @@ function markdownTable(table, options = {}) {
23646
23650
  } else if (code3 === 114) {
23647
23651
  after = ":";
23648
23652
  }
23649
- let size = options.alignDelimiters === false ? 1 : Math.max(
23653
+ let size = settings.alignDelimiters === false ? 1 : Math.max(
23650
23654
  1,
23651
23655
  longestCellByColumn[columnIndex] - before.length - after.length
23652
23656
  );
23653
23657
  const cell = before + "-".repeat(size) + after;
23654
- if (options.alignDelimiters !== false) {
23658
+ if (settings.alignDelimiters !== false) {
23655
23659
  size = before.length + size + after.length;
23656
23660
  if (size > longestCellByColumn[columnIndex]) {
23657
23661
  longestCellByColumn[columnIndex] = size;
@@ -23673,7 +23677,7 @@ function markdownTable(table, options = {}) {
23673
23677
  const cell = row2[columnIndex] || "";
23674
23678
  let before = "";
23675
23679
  let after = "";
23676
- if (options.alignDelimiters !== false) {
23680
+ if (settings.alignDelimiters !== false) {
23677
23681
  const size = longestCellByColumn[columnIndex] - (sizes2[columnIndex] || 0);
23678
23682
  const code3 = alignments[columnIndex];
23679
23683
  if (code3 === 114) {
@@ -23690,28 +23694,28 @@ function markdownTable(table, options = {}) {
23690
23694
  after = " ".repeat(size);
23691
23695
  }
23692
23696
  }
23693
- if (options.delimiterStart !== false && !columnIndex) {
23697
+ if (settings.delimiterStart !== false && !columnIndex) {
23694
23698
  line2.push("|");
23695
23699
  }
23696
- if (options.padding !== false && !(options.alignDelimiters === false && cell === "") && (options.delimiterStart !== false || columnIndex)) {
23700
+ if (settings.padding !== false && !(settings.alignDelimiters === false && cell === "") && (settings.delimiterStart !== false || columnIndex)) {
23697
23701
  line2.push(" ");
23698
23702
  }
23699
- if (options.alignDelimiters !== false) {
23703
+ if (settings.alignDelimiters !== false) {
23700
23704
  line2.push(before);
23701
23705
  }
23702
23706
  line2.push(cell);
23703
- if (options.alignDelimiters !== false) {
23707
+ if (settings.alignDelimiters !== false) {
23704
23708
  line2.push(after);
23705
23709
  }
23706
- if (options.padding !== false) {
23710
+ if (settings.padding !== false) {
23707
23711
  line2.push(" ");
23708
23712
  }
23709
- if (options.delimiterEnd !== false || columnIndex !== mostCellsPerRow - 1) {
23713
+ if (settings.delimiterEnd !== false || columnIndex !== mostCellsPerRow - 1) {
23710
23714
  line2.push("|");
23711
23715
  }
23712
23716
  }
23713
23717
  lines2.push(
23714
- options.delimiterEnd === false ? line2.join("").replace(/ +$/, "") : line2.join("")
23718
+ settings.delimiterEnd === false ? line2.join("").replace(/ +$/, "") : line2.join("")
23715
23719
  );
23716
23720
  }
23717
23721
  return lines2.join("\n");
@@ -23719,9 +23723,6 @@ function markdownTable(table, options = {}) {
23719
23723
  function serialize(value) {
23720
23724
  return value === null || value === void 0 ? "" : String(value);
23721
23725
  }
23722
- function defaultStringLength(value) {
23723
- return value.length;
23724
- }
23725
23726
  function toAlignment(value) {
23726
23727
  const code3 = typeof value === "string" ? value.codePointAt(0) : 0;
23727
23728
  return code3 === 67 || code3 === 99 ? 99 : code3 === 76 || code3 === 108 ? 108 : code3 === 82 || code3 === 114 ? 114 : 0;
@@ -40750,6 +40751,12 @@ var blockElement = (content3, field, imageCallback) => {
40750
40751
  type: "paragraph",
40751
40752
  children: eat2(content3.children, field, imageCallback)
40752
40753
  };
40754
+ case "mermaid":
40755
+ return {
40756
+ type: "code",
40757
+ lang: "mermaid",
40758
+ value: content3.value
40759
+ };
40753
40760
  case "code_block":
40754
40761
  return {
40755
40762
  type: "code",
@@ -40758,11 +40765,11 @@ var blockElement = (content3, field, imageCallback) => {
40758
40765
  };
40759
40766
  case "mdxJsxFlowElement":
40760
40767
  if (content3.name === "table") {
40761
- const table = content3.props;
40768
+ const table2 = content3.props;
40762
40769
  return {
40763
40770
  type: "table",
40764
- align: table.align,
40765
- children: table.tableRows.map((tableRow) => {
40771
+ align: table2.align,
40772
+ children: table2.tableRows.map((tableRow) => {
40766
40773
  const tr2 = {
40767
40774
  type: "tableRow",
40768
40775
  children: tableRow.tableCells.map(({ value }) => {
@@ -40859,6 +40866,28 @@ var blockElement = (content3, field, imageCallback) => {
40859
40866
  }
40860
40867
  ]
40861
40868
  };
40869
+ case "table":
40870
+ const table = content3.props;
40871
+ return {
40872
+ type: "table",
40873
+ align: table == null ? void 0 : table.align,
40874
+ children: content3.children.map((tableRow) => {
40875
+ return {
40876
+ type: "tableRow",
40877
+ children: tableRow.children.map((tableCell) => {
40878
+ var _a3, _b;
40879
+ return {
40880
+ type: "tableCell",
40881
+ children: eat2(
40882
+ ((_b = (_a3 = tableCell.children) == null ? void 0 : _a3.at(0)) == null ? void 0 : _b.children) || [],
40883
+ field,
40884
+ imageCallback
40885
+ )
40886
+ };
40887
+ })
40888
+ };
40889
+ })
40890
+ };
40862
40891
  default:
40863
40892
  throw new Error(`BlockElement: ${content3.type} is not yet supported`);
40864
40893
  }
@@ -41426,6 +41455,12 @@ var blockElement2 = (content3, field, imageCallback) => {
41426
41455
  type: "paragraph",
41427
41456
  children: eat3(content3.children, field, imageCallback)
41428
41457
  };
41458
+ case "mermaid":
41459
+ return {
41460
+ type: "code",
41461
+ lang: "mermaid",
41462
+ value: content3.value
41463
+ };
41429
41464
  case "code_block":
41430
41465
  return {
41431
41466
  type: "code",
@@ -41434,11 +41469,11 @@ var blockElement2 = (content3, field, imageCallback) => {
41434
41469
  };
41435
41470
  case "mdxJsxFlowElement":
41436
41471
  if (content3.name === "table") {
41437
- const table = content3.props;
41472
+ const table2 = content3.props;
41438
41473
  return {
41439
41474
  type: "table",
41440
- align: table.align,
41441
- children: table.tableRows.map((tableRow) => {
41475
+ align: table2.align,
41476
+ children: table2.tableRows.map((tableRow) => {
41442
41477
  const tr2 = {
41443
41478
  type: "tableRow",
41444
41479
  children: tableRow.tableCells.map(({ value }) => {
@@ -41506,6 +41541,28 @@ var blockElement2 = (content3, field, imageCallback) => {
41506
41541
  }
41507
41542
  ]
41508
41543
  };
41544
+ case "table":
41545
+ const table = content3.props;
41546
+ return {
41547
+ type: "table",
41548
+ align: table == null ? void 0 : table.align,
41549
+ children: content3.children.map((tableRow) => {
41550
+ return {
41551
+ type: "tableRow",
41552
+ children: tableRow.children.map((tableCell) => {
41553
+ var _a3, _b;
41554
+ return {
41555
+ type: "tableCell",
41556
+ children: eat3(
41557
+ ((_b = (_a3 = tableCell.children) == null ? void 0 : _a3.at(0)) == null ? void 0 : _b.children) || [],
41558
+ field,
41559
+ imageCallback
41560
+ )
41561
+ };
41562
+ })
41563
+ };
41564
+ })
41565
+ };
41509
41566
  default:
41510
41567
  throw new Error(`BlockElement: ${content3.type} is not yet supported`);
41511
41568
  }
@@ -43946,32 +44003,29 @@ var remarkToSlate = (root2, field, imageCallback, raw, skipMDXProcess) => {
43946
44003
  switch (content4.type) {
43947
44004
  case "table": {
43948
44005
  return {
43949
- type: "mdxJsxFlowElement",
43950
- children: [{ type: "text", text: "" }],
43951
- name: "table",
43952
- props: {
43953
- align: (_a3 = content4.align) == null ? void 0 : _a3.filter((item) => !!item),
43954
- tableRows: content4.children.map((child) => {
43955
- return {
43956
- tableCells: child.children.map((child2) => {
43957
- return {
43958
- value: {
43959
- type: "root",
43960
- children: [
43961
- {
43962
- type: "p",
43963
- children: (0, import_lodash.default)(
43964
- child2.children.map(
43965
- (child3) => phrasingContent(child3)
43966
- )
43967
- )
43968
- }
43969
- ]
44006
+ type: "table",
44007
+ children: content4.children.map((tableRow) => {
44008
+ return {
44009
+ type: "tr",
44010
+ children: tableRow.children.map((tableCell) => {
44011
+ return {
44012
+ type: "td",
44013
+ children: [
44014
+ {
44015
+ type: "p",
44016
+ children: (0, import_lodash.default)(
44017
+ tableCell.children.map(
44018
+ (child) => phrasingContent(child)
44019
+ )
44020
+ )
43970
44021
  }
43971
- };
43972
- })
43973
- };
43974
- })
44022
+ ]
44023
+ };
44024
+ })
44025
+ };
44026
+ }),
44027
+ props: {
44028
+ align: (_a3 = content4.align) == null ? void 0 : _a3.filter((item) => !!item)
43975
44029
  }
43976
44030
  };
43977
44031
  }
@@ -43990,7 +44044,7 @@ var remarkToSlate = (root2, field, imageCallback, raw, skipMDXProcess) => {
43990
44044
  case "heading":
43991
44045
  return heading2(content4);
43992
44046
  case "code":
43993
- return code3(content4);
44047
+ return parseCode(content4);
43994
44048
  case "paragraph":
43995
44049
  return paragraph2(content4);
43996
44050
  case "mdxJsxFlowElement":
@@ -44137,6 +44191,19 @@ var remarkToSlate = (root2, field, imageCallback, raw, skipMDXProcess) => {
44137
44191
  );
44138
44192
  }
44139
44193
  };
44194
+ const parseCode = (content4) => {
44195
+ if (content4.lang === "mermaid") {
44196
+ return mermaid(content4);
44197
+ }
44198
+ return code3(content4);
44199
+ };
44200
+ const mermaid = (content4) => {
44201
+ return {
44202
+ type: "mermaid",
44203
+ value: content4.value,
44204
+ children: [{ type: "text", text: "" }]
44205
+ };
44206
+ };
44140
44207
  const code3 = (content4) => {
44141
44208
  const extra = {};
44142
44209
  if (content4.lang)
package/dist/index.mjs CHANGED
@@ -23584,10 +23584,14 @@ function peekDelete() {
23584
23584
  return "~";
23585
23585
  }
23586
23586
 
23587
- // ../../../node_modules/.pnpm/markdown-table@3.0.3/node_modules/markdown-table/index.js
23588
- function markdownTable(table, options = {}) {
23589
- const align = (options.align || []).concat();
23590
- const stringLength = options.stringLength || defaultStringLength;
23587
+ // ../../../node_modules/.pnpm/markdown-table@3.0.4/node_modules/markdown-table/index.js
23588
+ function defaultStringLength(value) {
23589
+ return value.length;
23590
+ }
23591
+ function markdownTable(table, options) {
23592
+ const settings = options || {};
23593
+ const align = (settings.align || []).concat();
23594
+ const stringLength = settings.stringLength || defaultStringLength;
23591
23595
  const alignments = [];
23592
23596
  const cellMatrix = [];
23593
23597
  const sizeMatrix = [];
@@ -23603,7 +23607,7 @@ function markdownTable(table, options = {}) {
23603
23607
  }
23604
23608
  while (++columnIndex2 < table[rowIndex].length) {
23605
23609
  const cell = serialize(table[rowIndex][columnIndex2]);
23606
- if (options.alignDelimiters !== false) {
23610
+ if (settings.alignDelimiters !== false) {
23607
23611
  const size = stringLength(cell);
23608
23612
  sizes2[columnIndex2] = size;
23609
23613
  if (longestCellByColumn[columnIndex2] === void 0 || size > longestCellByColumn[columnIndex2]) {
@@ -23641,12 +23645,12 @@ function markdownTable(table, options = {}) {
23641
23645
  } else if (code3 === 114) {
23642
23646
  after = ":";
23643
23647
  }
23644
- let size = options.alignDelimiters === false ? 1 : Math.max(
23648
+ let size = settings.alignDelimiters === false ? 1 : Math.max(
23645
23649
  1,
23646
23650
  longestCellByColumn[columnIndex] - before.length - after.length
23647
23651
  );
23648
23652
  const cell = before + "-".repeat(size) + after;
23649
- if (options.alignDelimiters !== false) {
23653
+ if (settings.alignDelimiters !== false) {
23650
23654
  size = before.length + size + after.length;
23651
23655
  if (size > longestCellByColumn[columnIndex]) {
23652
23656
  longestCellByColumn[columnIndex] = size;
@@ -23668,7 +23672,7 @@ function markdownTable(table, options = {}) {
23668
23672
  const cell = row2[columnIndex] || "";
23669
23673
  let before = "";
23670
23674
  let after = "";
23671
- if (options.alignDelimiters !== false) {
23675
+ if (settings.alignDelimiters !== false) {
23672
23676
  const size = longestCellByColumn[columnIndex] - (sizes2[columnIndex] || 0);
23673
23677
  const code3 = alignments[columnIndex];
23674
23678
  if (code3 === 114) {
@@ -23685,28 +23689,28 @@ function markdownTable(table, options = {}) {
23685
23689
  after = " ".repeat(size);
23686
23690
  }
23687
23691
  }
23688
- if (options.delimiterStart !== false && !columnIndex) {
23692
+ if (settings.delimiterStart !== false && !columnIndex) {
23689
23693
  line2.push("|");
23690
23694
  }
23691
- if (options.padding !== false && !(options.alignDelimiters === false && cell === "") && (options.delimiterStart !== false || columnIndex)) {
23695
+ if (settings.padding !== false && !(settings.alignDelimiters === false && cell === "") && (settings.delimiterStart !== false || columnIndex)) {
23692
23696
  line2.push(" ");
23693
23697
  }
23694
- if (options.alignDelimiters !== false) {
23698
+ if (settings.alignDelimiters !== false) {
23695
23699
  line2.push(before);
23696
23700
  }
23697
23701
  line2.push(cell);
23698
- if (options.alignDelimiters !== false) {
23702
+ if (settings.alignDelimiters !== false) {
23699
23703
  line2.push(after);
23700
23704
  }
23701
- if (options.padding !== false) {
23705
+ if (settings.padding !== false) {
23702
23706
  line2.push(" ");
23703
23707
  }
23704
- if (options.delimiterEnd !== false || columnIndex !== mostCellsPerRow - 1) {
23708
+ if (settings.delimiterEnd !== false || columnIndex !== mostCellsPerRow - 1) {
23705
23709
  line2.push("|");
23706
23710
  }
23707
23711
  }
23708
23712
  lines2.push(
23709
- options.delimiterEnd === false ? line2.join("").replace(/ +$/, "") : line2.join("")
23713
+ settings.delimiterEnd === false ? line2.join("").replace(/ +$/, "") : line2.join("")
23710
23714
  );
23711
23715
  }
23712
23716
  return lines2.join("\n");
@@ -23714,9 +23718,6 @@ function markdownTable(table, options = {}) {
23714
23718
  function serialize(value) {
23715
23719
  return value === null || value === void 0 ? "" : String(value);
23716
23720
  }
23717
- function defaultStringLength(value) {
23718
- return value.length;
23719
- }
23720
23721
  function toAlignment(value) {
23721
23722
  const code3 = typeof value === "string" ? value.codePointAt(0) : 0;
23722
23723
  return code3 === 67 || code3 === 99 ? 99 : code3 === 76 || code3 === 108 ? 108 : code3 === 82 || code3 === 114 ? 114 : 0;
@@ -40733,6 +40734,12 @@ var blockElement = (content3, field, imageCallback) => {
40733
40734
  type: "paragraph",
40734
40735
  children: eat2(content3.children, field, imageCallback)
40735
40736
  };
40737
+ case "mermaid":
40738
+ return {
40739
+ type: "code",
40740
+ lang: "mermaid",
40741
+ value: content3.value
40742
+ };
40736
40743
  case "code_block":
40737
40744
  return {
40738
40745
  type: "code",
@@ -40741,11 +40748,11 @@ var blockElement = (content3, field, imageCallback) => {
40741
40748
  };
40742
40749
  case "mdxJsxFlowElement":
40743
40750
  if (content3.name === "table") {
40744
- const table = content3.props;
40751
+ const table2 = content3.props;
40745
40752
  return {
40746
40753
  type: "table",
40747
- align: table.align,
40748
- children: table.tableRows.map((tableRow) => {
40754
+ align: table2.align,
40755
+ children: table2.tableRows.map((tableRow) => {
40749
40756
  const tr2 = {
40750
40757
  type: "tableRow",
40751
40758
  children: tableRow.tableCells.map(({ value }) => {
@@ -40841,6 +40848,27 @@ var blockElement = (content3, field, imageCallback) => {
40841
40848
  }
40842
40849
  ]
40843
40850
  };
40851
+ case "table":
40852
+ const table = content3.props;
40853
+ return {
40854
+ type: "table",
40855
+ align: table?.align,
40856
+ children: content3.children.map((tableRow) => {
40857
+ return {
40858
+ type: "tableRow",
40859
+ children: tableRow.children.map((tableCell) => {
40860
+ return {
40861
+ type: "tableCell",
40862
+ children: eat2(
40863
+ tableCell.children?.at(0)?.children || [],
40864
+ field,
40865
+ imageCallback
40866
+ )
40867
+ };
40868
+ })
40869
+ };
40870
+ })
40871
+ };
40844
40872
  default:
40845
40873
  throw new Error(`BlockElement: ${content3.type} is not yet supported`);
40846
40874
  }
@@ -41403,6 +41431,12 @@ var blockElement2 = (content3, field, imageCallback) => {
41403
41431
  type: "paragraph",
41404
41432
  children: eat3(content3.children, field, imageCallback)
41405
41433
  };
41434
+ case "mermaid":
41435
+ return {
41436
+ type: "code",
41437
+ lang: "mermaid",
41438
+ value: content3.value
41439
+ };
41406
41440
  case "code_block":
41407
41441
  return {
41408
41442
  type: "code",
@@ -41411,11 +41445,11 @@ var blockElement2 = (content3, field, imageCallback) => {
41411
41445
  };
41412
41446
  case "mdxJsxFlowElement":
41413
41447
  if (content3.name === "table") {
41414
- const table = content3.props;
41448
+ const table2 = content3.props;
41415
41449
  return {
41416
41450
  type: "table",
41417
- align: table.align,
41418
- children: table.tableRows.map((tableRow) => {
41451
+ align: table2.align,
41452
+ children: table2.tableRows.map((tableRow) => {
41419
41453
  const tr2 = {
41420
41454
  type: "tableRow",
41421
41455
  children: tableRow.tableCells.map(({ value }) => {
@@ -41482,6 +41516,27 @@ var blockElement2 = (content3, field, imageCallback) => {
41482
41516
  }
41483
41517
  ]
41484
41518
  };
41519
+ case "table":
41520
+ const table = content3.props;
41521
+ return {
41522
+ type: "table",
41523
+ align: table?.align,
41524
+ children: content3.children.map((tableRow) => {
41525
+ return {
41526
+ type: "tableRow",
41527
+ children: tableRow.children.map((tableCell) => {
41528
+ return {
41529
+ type: "tableCell",
41530
+ children: eat3(
41531
+ tableCell.children?.at(0)?.children || [],
41532
+ field,
41533
+ imageCallback
41534
+ )
41535
+ };
41536
+ })
41537
+ };
41538
+ })
41539
+ };
41485
41540
  default:
41486
41541
  throw new Error(`BlockElement: ${content3.type} is not yet supported`);
41487
41542
  }
@@ -43915,32 +43970,29 @@ var remarkToSlate = (root2, field, imageCallback, raw, skipMDXProcess) => {
43915
43970
  switch (content4.type) {
43916
43971
  case "table": {
43917
43972
  return {
43918
- type: "mdxJsxFlowElement",
43919
- children: [{ type: "text", text: "" }],
43920
- name: "table",
43921
- props: {
43922
- align: content4.align?.filter((item) => !!item),
43923
- tableRows: content4.children.map((child) => {
43924
- return {
43925
- tableCells: child.children.map((child2) => {
43926
- return {
43927
- value: {
43928
- type: "root",
43929
- children: [
43930
- {
43931
- type: "p",
43932
- children: (0, import_lodash.default)(
43933
- child2.children.map(
43934
- (child3) => phrasingContent(child3)
43935
- )
43936
- )
43937
- }
43938
- ]
43973
+ type: "table",
43974
+ children: content4.children.map((tableRow) => {
43975
+ return {
43976
+ type: "tr",
43977
+ children: tableRow.children.map((tableCell) => {
43978
+ return {
43979
+ type: "td",
43980
+ children: [
43981
+ {
43982
+ type: "p",
43983
+ children: (0, import_lodash.default)(
43984
+ tableCell.children.map(
43985
+ (child) => phrasingContent(child)
43986
+ )
43987
+ )
43939
43988
  }
43940
- };
43941
- })
43942
- };
43943
- })
43989
+ ]
43990
+ };
43991
+ })
43992
+ };
43993
+ }),
43994
+ props: {
43995
+ align: content4.align?.filter((item) => !!item)
43944
43996
  }
43945
43997
  };
43946
43998
  }
@@ -43959,7 +44011,7 @@ var remarkToSlate = (root2, field, imageCallback, raw, skipMDXProcess) => {
43959
44011
  case "heading":
43960
44012
  return heading2(content4);
43961
44013
  case "code":
43962
- return code3(content4);
44014
+ return parseCode(content4);
43963
44015
  case "paragraph":
43964
44016
  return paragraph2(content4);
43965
44017
  case "mdxJsxFlowElement":
@@ -44106,6 +44158,19 @@ var remarkToSlate = (root2, field, imageCallback, raw, skipMDXProcess) => {
44106
44158
  );
44107
44159
  }
44108
44160
  };
44161
+ const parseCode = (content4) => {
44162
+ if (content4.lang === "mermaid") {
44163
+ return mermaid(content4);
44164
+ }
44165
+ return code3(content4);
44166
+ };
44167
+ const mermaid = (content4) => {
44168
+ return {
44169
+ type: "mermaid",
44170
+ value: content4.value,
44171
+ children: [{ type: "text", text: "" }]
44172
+ };
44173
+ };
44109
44174
  const code3 = (content4) => {
44110
44175
  const extra = {};
44111
44176
  if (content4.lang)
@@ -0,0 +1,2 @@
1
+ import type { RichTextField } from '@tinacms/schema-tools';
2
+ export declare const field: RichTextField;
@@ -0,0 +1 @@
1
+ export {};
@@ -121,7 +121,37 @@ export type ParagraphElement = {
121
121
  /**
122
122
  * @group BlockElement
123
123
  */
124
- export type BlockElement = BlockquoteElement | CodeBlockElement | HeadingElement | HrElement | HTMLElement | ImageElement | InvalidMarkdownElement | ListItemElement | MdxBlockElement | ParagraphElement | OrderedListElement | UnorderedListElement;
124
+ export type TableCellElement = {
125
+ type: 'td';
126
+ children: ParagraphElement[];
127
+ };
128
+ /**
129
+ * @group BlockElement
130
+ */
131
+ export type TableRowElement = {
132
+ type: 'tr';
133
+ children: TableCellElement[];
134
+ };
135
+ /**
136
+ * @group BlockElement
137
+ */
138
+ export type TableElement = {
139
+ type: 'table';
140
+ children: TableRowElement[];
141
+ props: Record<string, unknown>;
142
+ };
143
+ /**
144
+ * @group MermaidElement
145
+ */
146
+ export type MermaidElement = {
147
+ type: 'mermaid';
148
+ value: string;
149
+ children: [EmptyTextElement];
150
+ };
151
+ /**
152
+ * @group BlockElement
153
+ */
154
+ export type BlockElement = BlockquoteElement | CodeBlockElement | HeadingElement | HrElement | HTMLElement | ImageElement | InvalidMarkdownElement | ListItemElement | MdxBlockElement | ParagraphElement | MermaidElement | OrderedListElement | UnorderedListElement | TableCellElement | TableRowElement | TableElement;
125
155
  /**
126
156
  * @group InlineElement
127
157
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tinacms/mdx",
3
- "version": "0.0.0-c8b1d84-20241003015733",
3
+ "version": "0.0.0-d524599-20241115065930",
4
4
  "typings": "dist/index.d.ts",
5
5
  "main": "dist/index.js",
6
6
  "browser": "dist/index.browser.mjs",
@@ -50,13 +50,13 @@
50
50
  "remark-gfm": "^2.0.0",
51
51
  "remark-mdx": "2.3.0",
52
52
  "stringify-entities": "4.0.3",
53
- "typedoc": "^0.26.7",
53
+ "typedoc": "^0.26.11",
54
54
  "unist-util-source": "4.0.2",
55
55
  "unist-util-stringify-position": "3.0.3",
56
56
  "unist-util-visit": "4.1.2",
57
57
  "uvu": "0.5.6",
58
58
  "vfile-message": "3.1.4",
59
- "@tinacms/schema-tools": "0.0.0-c8b1d84-20241003015733"
59
+ "@tinacms/schema-tools": "0.0.0-d524599-20241115065930"
60
60
  },
61
61
  "publishConfig": {
62
62
  "registry": "https://registry.npmjs.org"
@@ -69,7 +69,7 @@
69
69
  "@types/estree": "1.0.0",
70
70
  "@types/lodash.flatten": "^4.4.9",
71
71
  "@types/mdast": "^3.0.15",
72
- "@types/node": "^22.7.4",
72
+ "@types/node": "^22.9.0",
73
73
  "@types/prettier": "^2.7.3",
74
74
  "@types/unist": "^2.0.11",
75
75
  "c8": "^7.14.0",
@@ -77,10 +77,10 @@
77
77
  "jest-file-snapshot": "^0.5.0",
78
78
  "ts-node": "^10.9.2",
79
79
  "typedoc-plugin-markdown": "^3.17.1",
80
- "typescript": "^5.6.2",
80
+ "typescript": "^5.6.3",
81
81
  "vite": "^4.5.5",
82
82
  "vitest": "^0.32.4",
83
- "@tinacms/scripts": "1.2.3"
83
+ "@tinacms/scripts": "0.0.0-d524599-20241115065930"
84
84
  },
85
85
  "scripts": {
86
86
  "types": "tsc",