@tinacms/mdx 0.61.0 → 0.61.3

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.
package/dist/index.js CHANGED
@@ -244674,8 +244674,10 @@ var markdownToAst = (value, field) => {
244674
244674
  throw new Error("Global templates are not supported");
244675
244675
  }
244676
244676
  if (template.match) {
244677
- preprocessedString = replaceAll(preprocessedString, template.match.start, `<${template.name}>\``);
244678
- preprocessedString = replaceAll(preprocessedString, template.match.end, `\`</${template.name}>`);
244677
+ if (preprocessedString) {
244678
+ preprocessedString = replaceAll(preprocessedString, template.match.start, `<${template.name}>\``);
244679
+ preprocessedString = replaceAll(preprocessedString, template.match.end, `\`</${template.name}>`);
244680
+ }
244679
244681
  }
244680
244682
  });
244681
244683
  try {
@@ -244951,7 +244953,7 @@ var replaceLinksWithTextNodes = (content3) => {
244951
244953
  type: "link",
244952
244954
  url: item.url,
244953
244955
  title: item.title,
244954
- children: [text4({ text: a.value })]
244956
+ children: [a]
244955
244957
  };
244956
244958
  }
244957
244959
  }));
@@ -245011,12 +245013,24 @@ var text4 = (content3) => {
245011
245013
  };
245012
245014
  };
245013
245015
  var eat2 = (c, field, imageCallback) => {
245016
+ var _a, _b;
245014
245017
  const content3 = replaceLinksWithTextNodes(c);
245015
245018
  const first = content3[0];
245016
245019
  if (!first) {
245017
245020
  return [];
245018
245021
  }
245019
245022
  if (first && (first == null ? void 0 : first.type) !== "text") {
245023
+ if (first.type === "a") {
245024
+ return [
245025
+ {
245026
+ type: "link",
245027
+ url: first.url,
245028
+ title: first.title,
245029
+ children: eat2(first.children, field, imageCallback)
245030
+ },
245031
+ ...eat2(content3.slice(1), field, imageCallback)
245032
+ ];
245033
+ }
245020
245034
  return [
245021
245035
  inlineElementExceptLink(first, field, imageCallback),
245022
245036
  ...eat2(content3.slice(1), field, imageCallback)
@@ -245072,11 +245086,12 @@ var eat2 = (c, field, imageCallback) => {
245072
245086
  if (nonMatchingSiblingIndex) {
245073
245087
  throw new Error(`Marks inside inline code are not supported`);
245074
245088
  }
245089
+ const node = {
245090
+ type: markToProcess,
245091
+ value: first.text
245092
+ };
245075
245093
  return [
245076
- {
245077
- type: markToProcess,
245078
- value: first.text
245079
- },
245094
+ (_b = (_a = first.linkifyTextNode) == null ? void 0 : _a.call(first, node)) != null ? _b : node,
245080
245095
  ...eat2(content3.slice(nonMatchingSiblingIndex + 1), field, imageCallback)
245081
245096
  ];
245082
245097
  }
@@ -245221,6 +245236,13 @@ var blockElement = (content3, field, imageCallback) => {
245221
245236
  value: content3.value
245222
245237
  };
245223
245238
  }
245239
+ case "img":
245240
+ return {
245241
+ type: "image",
245242
+ url: imageCallback(content3.url),
245243
+ alt: content3.alt,
245244
+ title: content3.caption
245245
+ };
245224
245246
  default:
245225
245247
  throw new Error(`BlockElement: ${content3.type} is not yet supported`);
245226
245248
  }
@@ -83,7 +83,7 @@ export declare type OrderedListElement = {
83
83
  children: ListItemElement[];
84
84
  };
85
85
  export declare type List = OrderedListElement | UnorderedListElement;
86
- export declare type BlockElement = HeadingElement | ParagraphElement | CodeBlockElement | BlockquoteElement | MdxBlockElement | HTMLElement | UnorderedListElement | OrderedListElement | ListItemElement | HrElement | InvalidMarkdownElement;
86
+ export declare type BlockElement = HeadingElement | ParagraphElement | CodeBlockElement | BlockquoteElement | MdxBlockElement | HTMLElement | ImageElement | UnorderedListElement | OrderedListElement | ListItemElement | HrElement | InvalidMarkdownElement;
87
87
  export declare type MdxInlineElement = {
88
88
  type: 'mdxJsxTextElement';
89
89
  name: string | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tinacms/mdx",
3
- "version": "0.61.0",
3
+ "version": "0.61.3",
4
4
  "typings": "dist/index.d.ts",
5
5
  "main": "dist/index.js",
6
6
  "files": [
@@ -39,7 +39,7 @@
39
39
  "devDependencies": {
40
40
  "@swc/core": "^1.2.210",
41
41
  "@swc/jest": "^0.2.21",
42
- "@tinacms/scripts": "0.51.0",
42
+ "@tinacms/scripts": "0.51.1",
43
43
  "@types/cors": "^2.8.7",
44
44
  "@types/estree": "^0.0.50",
45
45
  "@types/estree-jsx": "^1.0.0",