@tinacms/mdx 1.5.4 → 1.6.1

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.
@@ -38618,7 +38618,7 @@ var eat2 = (c, field, imageCallback) => {
38618
38618
  }
38619
38619
  if (markToProcess === "inlineCode") {
38620
38620
  if (nonMatchingSiblingIndex) {
38621
- throw new Error(`Marks inside inline code are not supported`);
38621
+ throw new Error("Marks inside inline code are not supported");
38622
38622
  }
38623
38623
  const node2 = {
38624
38624
  type: markToProcess,
@@ -38653,7 +38653,8 @@ var cleanNode = (node2, mark) => {
38653
38653
  const markToClear = {
38654
38654
  strong: "bold",
38655
38655
  emphasis: "italic",
38656
- inlineCode: "code"
38656
+ inlineCode: "code",
38657
+ delete: "strikethrough"
38657
38658
  }[mark];
38658
38659
  Object.entries(node2).map(([key, value]) => {
38659
38660
  if (key !== markToClear) {
@@ -39111,6 +39112,9 @@ var getMarks = (content3) => {
39111
39112
  if (content3.code) {
39112
39113
  marks.push("inlineCode");
39113
39114
  }
39115
+ if (content3.strikethrough) {
39116
+ marks.push("delete");
39117
+ }
39114
39118
  return marks;
39115
39119
  };
39116
39120
 
@@ -39555,7 +39559,8 @@ var cleanNode2 = (node2, mark) => {
39555
39559
  const markToClear = {
39556
39560
  strong: "bold",
39557
39561
  emphasis: "italic",
39558
- inlineCode: "code"
39562
+ inlineCode: "code",
39563
+ delete: "strikethrough"
39559
39564
  }[mark];
39560
39565
  Object.entries(node2).map(([key, value]) => {
39561
39566
  if (key !== markToClear) {
@@ -42767,6 +42772,8 @@ var remarkToSlate = (root2, field, imageCallback, raw, skipMDXProcess) => {
42767
42772
  switch (content4.type) {
42768
42773
  case "text":
42769
42774
  return text7(content4);
42775
+ case "delete":
42776
+ return phrashingMark(content4);
42770
42777
  case "link":
42771
42778
  return link2(content4);
42772
42779
  case "image":
@@ -42831,6 +42838,17 @@ var remarkToSlate = (root2, field, imageCallback, raw, skipMDXProcess) => {
42831
42838
  });
42832
42839
  break;
42833
42840
  }
42841
+ case "delete": {
42842
+ const children = (0, import_lodash.default)(
42843
+ node2.children.map(
42844
+ (child) => phrashingMark(child, [...marks, "strikethrough"])
42845
+ )
42846
+ );
42847
+ children.forEach((child) => {
42848
+ accum.push(child);
42849
+ });
42850
+ break;
42851
+ }
42834
42852
  case "strong": {
42835
42853
  const children = (0, import_lodash.default)(
42836
42854
  node2.children.map((child) => phrashingMark(child, [...marks, "bold"]))
package/dist/index.js CHANGED
@@ -5921,12 +5921,12 @@ var require_lodash = __commonJS({
5921
5921
  });
5922
5922
 
5923
5923
  // src/index.ts
5924
- var src_exports = {};
5925
- __export(src_exports, {
5924
+ var index_exports = {};
5925
+ __export(index_exports, {
5926
5926
  parseMDX: () => parseMDX,
5927
5927
  stringifyMDX: () => stringifyMDX
5928
5928
  });
5929
- module.exports = __toCommonJS(src_exports);
5929
+ module.exports = __toCommonJS(index_exports);
5930
5930
 
5931
5931
  // ../../../node_modules/.pnpm/bail@2.0.2/node_modules/bail/index.js
5932
5932
  function bail(error) {
@@ -40504,7 +40504,7 @@ var eat2 = (c, field, imageCallback) => {
40504
40504
  }
40505
40505
  if (markToProcess === "inlineCode") {
40506
40506
  if (nonMatchingSiblingIndex) {
40507
- throw new Error(`Marks inside inline code are not supported`);
40507
+ throw new Error("Marks inside inline code are not supported");
40508
40508
  }
40509
40509
  const node2 = {
40510
40510
  type: markToProcess,
@@ -40539,7 +40539,8 @@ var cleanNode = (node2, mark) => {
40539
40539
  const markToClear = {
40540
40540
  strong: "bold",
40541
40541
  emphasis: "italic",
40542
- inlineCode: "code"
40542
+ inlineCode: "code",
40543
+ delete: "strikethrough"
40543
40544
  }[mark];
40544
40545
  Object.entries(node2).map(([key, value]) => {
40545
40546
  if (key !== markToClear) {
@@ -41003,6 +41004,9 @@ var getMarks = (content3) => {
41003
41004
  if (content3.code) {
41004
41005
  marks.push("inlineCode");
41005
41006
  }
41007
+ if (content3.strikethrough) {
41008
+ marks.push("delete");
41009
+ }
41006
41010
  return marks;
41007
41011
  };
41008
41012
 
@@ -41451,7 +41455,8 @@ var cleanNode2 = (node2, mark) => {
41451
41455
  const markToClear = {
41452
41456
  strong: "bold",
41453
41457
  emphasis: "italic",
41454
- inlineCode: "code"
41458
+ inlineCode: "code",
41459
+ delete: "strikethrough"
41455
41460
  }[mark];
41456
41461
  Object.entries(node2).map(([key, value]) => {
41457
41462
  if (key !== markToClear) {
@@ -44673,6 +44678,8 @@ var remarkToSlate = (root2, field, imageCallback, raw, skipMDXProcess) => {
44673
44678
  switch (content4.type) {
44674
44679
  case "text":
44675
44680
  return text7(content4);
44681
+ case "delete":
44682
+ return phrashingMark(content4);
44676
44683
  case "link":
44677
44684
  return link2(content4);
44678
44685
  case "image":
@@ -44737,6 +44744,17 @@ var remarkToSlate = (root2, field, imageCallback, raw, skipMDXProcess) => {
44737
44744
  });
44738
44745
  break;
44739
44746
  }
44747
+ case "delete": {
44748
+ const children = (0, import_lodash.default)(
44749
+ node2.children.map(
44750
+ (child) => phrashingMark(child, [...marks, "strikethrough"])
44751
+ )
44752
+ );
44753
+ children.forEach((child) => {
44754
+ accum.push(child);
44755
+ });
44756
+ break;
44757
+ }
44740
44758
  case "strong": {
44741
44759
  const children = (0, import_lodash.default)(
44742
44760
  node2.children.map((child) => phrashingMark(child, [...marks, "bold"]))
package/dist/index.mjs CHANGED
@@ -40488,7 +40488,7 @@ var eat2 = (c, field, imageCallback) => {
40488
40488
  }
40489
40489
  if (markToProcess === "inlineCode") {
40490
40490
  if (nonMatchingSiblingIndex) {
40491
- throw new Error(`Marks inside inline code are not supported`);
40491
+ throw new Error("Marks inside inline code are not supported");
40492
40492
  }
40493
40493
  const node2 = {
40494
40494
  type: markToProcess,
@@ -40523,7 +40523,8 @@ var cleanNode = (node2, mark) => {
40523
40523
  const markToClear = {
40524
40524
  strong: "bold",
40525
40525
  emphasis: "italic",
40526
- inlineCode: "code"
40526
+ inlineCode: "code",
40527
+ delete: "strikethrough"
40527
40528
  }[mark];
40528
40529
  Object.entries(node2).map(([key, value]) => {
40529
40530
  if (key !== markToClear) {
@@ -40981,6 +40982,9 @@ var getMarks = (content3) => {
40981
40982
  if (content3.code) {
40982
40983
  marks.push("inlineCode");
40983
40984
  }
40985
+ if (content3.strikethrough) {
40986
+ marks.push("delete");
40987
+ }
40984
40988
  return marks;
40985
40989
  };
40986
40990
 
@@ -41425,7 +41429,8 @@ var cleanNode2 = (node2, mark) => {
41425
41429
  const markToClear = {
41426
41430
  strong: "bold",
41427
41431
  emphasis: "italic",
41428
- inlineCode: "code"
41432
+ inlineCode: "code",
41433
+ delete: "strikethrough"
41429
41434
  }[mark];
41430
41435
  Object.entries(node2).map(([key, value]) => {
41431
41436
  if (key !== markToClear) {
@@ -44637,6 +44642,8 @@ var remarkToSlate = (root2, field, imageCallback, raw, skipMDXProcess) => {
44637
44642
  switch (content4.type) {
44638
44643
  case "text":
44639
44644
  return text7(content4);
44645
+ case "delete":
44646
+ return phrashingMark(content4);
44640
44647
  case "link":
44641
44648
  return link2(content4);
44642
44649
  case "image":
@@ -44701,6 +44708,17 @@ var remarkToSlate = (root2, field, imageCallback, raw, skipMDXProcess) => {
44701
44708
  });
44702
44709
  break;
44703
44710
  }
44711
+ case "delete": {
44712
+ const children = (0, import_lodash.default)(
44713
+ node2.children.map(
44714
+ (child) => phrashingMark(child, [...marks, "strikethrough"])
44715
+ )
44716
+ );
44717
+ children.forEach((child) => {
44718
+ accum.push(child);
44719
+ });
44720
+ break;
44721
+ }
44704
44722
  case "strong": {
44705
44723
  const children = (0, import_lodash.default)(
44706
44724
  node2.children.map((child) => phrashingMark(child, [...marks, "bold"]))
@@ -5,5 +5,3 @@ import type { RootElement } from '../../parse/plate';
5
5
  export declare const preProcess: (tree: RootElement, field: RichTextField, imageCallback: (url: string) => string) => Md.Root;
6
6
  export declare const rootElement: (content: Plate.RootElement, field: RichTextField, imageCallback: (url: string) => string) => Md.Root;
7
7
  export declare const blockElement: (content: Plate.BlockElement, field: RichTextField, imageCallback: (url: string) => string) => Md.Content | null;
8
- export type Marks = 'strong' | 'emphasis' | 'inlineCode';
9
- export declare const getMarks: (content: Plate.InlineElement) => Marks[];
@@ -0,0 +1,2 @@
1
+ import type { RichTextField } from '@tinacms/schema-tools';
2
+ export declare const field: RichTextField;
@@ -181,6 +181,7 @@ export type TextElement = {
181
181
  bold?: boolean;
182
182
  italic?: boolean;
183
183
  code?: boolean;
184
+ strikethrough?: boolean;
184
185
  };
185
186
  /**
186
187
  * @remarks
@@ -32,5 +32,5 @@ export type Pattern = {
32
32
  export declare const toTinaMarkdown: (tree: Md.Root, field: RichTextType) => string;
33
33
  export declare const rootElement: (content: Plate.RootElement, field: RichTextType, imageCallback: (url: string) => string) => Md.Root;
34
34
  export declare const blockElement: (content: Plate.BlockElement, field: RichTextType, imageCallback: (url: string) => string) => Md.Content | null;
35
- export type Marks = 'strong' | 'emphasis' | 'inlineCode';
35
+ export type Marks = 'strong' | 'emphasis' | 'inlineCode' | 'delete';
36
36
  export declare const getMarks: (content: Plate.InlineElement) => Marks[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tinacms/mdx",
3
- "version": "1.5.4",
3
+ "version": "1.6.1",
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.7.0"
59
+ "@tinacms/schema-tools": "1.7.2"
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.9.0",
72
+ "@types/node": "^22.13.1",
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.3",
81
- "vite": "^4.5.5",
80
+ "typescript": "^5.7.3",
81
+ "vite": "^4.5.9",
82
82
  "vitest": "^0.32.4",
83
- "@tinacms/scripts": "1.3.1"
83
+ "@tinacms/scripts": "1.3.3"
84
84
  },
85
85
  "scripts": {
86
86
  "types": "tsc",