@tinacms/mdx 0.0.0-8eeb2df-20241010045955 → 0.0.0-a318f2f-20241010063440

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.
@@ -38861,6 +38861,12 @@ var blockElement = (content3, field, imageCallback) => {
38861
38861
  type: "paragraph",
38862
38862
  children: eat2(content3.children, field, imageCallback)
38863
38863
  };
38864
+ case "mermaid":
38865
+ return {
38866
+ type: "code",
38867
+ lang: "mermaid",
38868
+ value: content3.value
38869
+ };
38864
38870
  case "code_block":
38865
38871
  return {
38866
38872
  type: "code",
@@ -39209,6 +39215,7 @@ function stringifyProps2(element2, parentField, flatten2, imageCallback) {
39209
39215
  if (field.list) {
39210
39216
  throw new Error(`Rich-text list is not supported`);
39211
39217
  } else {
39218
+ console.log("RICH-TEXT StringifyProps", value);
39212
39219
  const joiner = flatten2 ? " " : "\n";
39213
39220
  let val = "";
39214
39221
  assertShape2(
@@ -39552,6 +39559,12 @@ var blockElement2 = (content3, field, imageCallback) => {
39552
39559
  type: "paragraph",
39553
39560
  children: eat3(content3.children, field, imageCallback)
39554
39561
  };
39562
+ case "mermaid":
39563
+ return {
39564
+ type: "code",
39565
+ lang: "mermaid",
39566
+ value: content3.value
39567
+ };
39555
39568
  case "code_block":
39556
39569
  return {
39557
39570
  type: "code",
@@ -42126,7 +42139,7 @@ var remarkToSlate = (root2, field, imageCallback, raw, skipMDXProcess) => {
42126
42139
  case "heading":
42127
42140
  return heading2(content4);
42128
42141
  case "code":
42129
- return code3(content4);
42142
+ return parseCode(content4);
42130
42143
  case "paragraph":
42131
42144
  return paragraph2(content4);
42132
42145
  case "mdxJsxFlowElement":
@@ -42273,6 +42286,19 @@ var remarkToSlate = (root2, field, imageCallback, raw, skipMDXProcess) => {
42273
42286
  );
42274
42287
  }
42275
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
+ };
42276
42302
  const code3 = (content4) => {
42277
42303
  const extra = {};
42278
42304
  if (content4.lang)
package/dist/index.js CHANGED
@@ -40750,6 +40750,12 @@ var blockElement = (content3, field, imageCallback) => {
40750
40750
  type: "paragraph",
40751
40751
  children: eat2(content3.children, field, imageCallback)
40752
40752
  };
40753
+ case "mermaid":
40754
+ return {
40755
+ type: "code",
40756
+ lang: "mermaid",
40757
+ value: content3.value
40758
+ };
40753
40759
  case "code_block":
40754
40760
  return {
40755
40761
  type: "code",
@@ -41103,6 +41109,7 @@ function stringifyProps2(element, parentField, flatten2, imageCallback) {
41103
41109
  if (field.list) {
41104
41110
  throw new Error(`Rich-text list is not supported`);
41105
41111
  } else {
41112
+ console.log("RICH-TEXT StringifyProps", value);
41106
41113
  const joiner = flatten2 ? " " : "\n";
41107
41114
  let val = "";
41108
41115
  assertShape2(
@@ -41448,6 +41455,12 @@ var blockElement2 = (content3, field, imageCallback) => {
41448
41455
  type: "paragraph",
41449
41456
  children: eat3(content3.children, field, imageCallback)
41450
41457
  };
41458
+ case "mermaid":
41459
+ return {
41460
+ type: "code",
41461
+ lang: "mermaid",
41462
+ value: content3.value
41463
+ };
41451
41464
  case "code_block":
41452
41465
  return {
41453
41466
  type: "code",
@@ -44031,7 +44044,7 @@ var remarkToSlate = (root2, field, imageCallback, raw, skipMDXProcess) => {
44031
44044
  case "heading":
44032
44045
  return heading2(content4);
44033
44046
  case "code":
44034
- return code3(content4);
44047
+ return parseCode(content4);
44035
44048
  case "paragraph":
44036
44049
  return paragraph2(content4);
44037
44050
  case "mdxJsxFlowElement":
@@ -44178,6 +44191,19 @@ var remarkToSlate = (root2, field, imageCallback, raw, skipMDXProcess) => {
44178
44191
  );
44179
44192
  }
44180
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
+ };
44181
44207
  const code3 = (content4) => {
44182
44208
  const extra = {};
44183
44209
  if (content4.lang)
package/dist/index.mjs CHANGED
@@ -40733,6 +40733,12 @@ var blockElement = (content3, field, imageCallback) => {
40733
40733
  type: "paragraph",
40734
40734
  children: eat2(content3.children, field, imageCallback)
40735
40735
  };
40736
+ case "mermaid":
40737
+ return {
40738
+ type: "code",
40739
+ lang: "mermaid",
40740
+ value: content3.value
40741
+ };
40736
40742
  case "code_block":
40737
40743
  return {
40738
40744
  type: "code",
@@ -41081,6 +41087,7 @@ function stringifyProps2(element, parentField, flatten2, imageCallback) {
41081
41087
  if (field.list) {
41082
41088
  throw new Error(`Rich-text list is not supported`);
41083
41089
  } else {
41090
+ console.log("RICH-TEXT StringifyProps", value);
41084
41091
  const joiner = flatten2 ? " " : "\n";
41085
41092
  let val = "";
41086
41093
  assertShape2(
@@ -41424,6 +41431,12 @@ var blockElement2 = (content3, field, imageCallback) => {
41424
41431
  type: "paragraph",
41425
41432
  children: eat3(content3.children, field, imageCallback)
41426
41433
  };
41434
+ case "mermaid":
41435
+ return {
41436
+ type: "code",
41437
+ lang: "mermaid",
41438
+ value: content3.value
41439
+ };
41427
41440
  case "code_block":
41428
41441
  return {
41429
41442
  type: "code",
@@ -43998,7 +44011,7 @@ var remarkToSlate = (root2, field, imageCallback, raw, skipMDXProcess) => {
43998
44011
  case "heading":
43999
44012
  return heading2(content4);
44000
44013
  case "code":
44001
- return code3(content4);
44014
+ return parseCode(content4);
44002
44015
  case "paragraph":
44003
44016
  return paragraph2(content4);
44004
44017
  case "mdxJsxFlowElement":
@@ -44145,6 +44158,19 @@ var remarkToSlate = (root2, field, imageCallback, raw, skipMDXProcess) => {
44145
44158
  );
44146
44159
  }
44147
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
+ };
44148
44174
  const code3 = (content4) => {
44149
44175
  const extra = {};
44150
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 {};
@@ -140,10 +140,18 @@ export type TableElement = {
140
140
  children: TableRowElement[];
141
141
  props: Record<string, unknown>;
142
142
  };
143
+ /**
144
+ * @group MermaidElement
145
+ */
146
+ export type MermaidElement = {
147
+ type: 'mermaid';
148
+ value: string;
149
+ children: [EmptyTextElement];
150
+ };
143
151
  /**
144
152
  * @group BlockElement
145
153
  */
146
- export type BlockElement = BlockquoteElement | CodeBlockElement | HeadingElement | HrElement | HTMLElement | ImageElement | InvalidMarkdownElement | ListItemElement | MdxBlockElement | ParagraphElement | OrderedListElement | UnorderedListElement | TableCellElement | TableRowElement | TableElement;
154
+ export type BlockElement = BlockquoteElement | CodeBlockElement | HeadingElement | HrElement | HTMLElement | ImageElement | InvalidMarkdownElement | ListItemElement | MdxBlockElement | ParagraphElement | MermaidElement | OrderedListElement | UnorderedListElement | TableCellElement | TableRowElement | TableElement;
147
155
  /**
148
156
  * @group InlineElement
149
157
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tinacms/mdx",
3
- "version": "0.0.0-8eeb2df-20241010045955",
3
+ "version": "0.0.0-a318f2f-20241010063440",
4
4
  "typings": "dist/index.d.ts",
5
5
  "main": "dist/index.js",
6
6
  "browser": "dist/index.browser.mjs",
@@ -56,7 +56,7 @@
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": "1.6.5"
59
+ "@tinacms/schema-tools": "0.0.0-a318f2f-20241010063440"
60
60
  },
61
61
  "publishConfig": {
62
62
  "registry": "https://registry.npmjs.org"
@@ -80,7 +80,7 @@
80
80
  "typescript": "^5.6.2",
81
81
  "vite": "^4.5.5",
82
82
  "vitest": "^0.32.4",
83
- "@tinacms/scripts": "0.0.0-8eeb2df-20241010045955"
83
+ "@tinacms/scripts": "0.0.0-a318f2f-20241010063440"
84
84
  },
85
85
  "scripts": {
86
86
  "types": "tsc",