@tinacms/mdx 0.0.0-cef656e-20250119001929 → 0.0.0-d1bd1a1-20251124051649

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.
@@ -4,6 +4,5 @@ import type * as Plate from '../../parse/plate';
4
4
  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
+ export declare const codeLinesToString: (children: any[]) => any[];
7
8
  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;
@@ -0,0 +1 @@
1
+ export {};
@@ -1,10 +1,5 @@
1
1
  export declare function removePosition(tree: any): any;
2
2
  export declare const print: (tree: object) => string;
3
3
  export declare const nodePath: (dir: string) => string;
4
- export declare const contextPath: (dir: string) => string;
5
- export declare const frontmatterContext: (contextMarkdown: string) => {
6
- _tinaEmbeds?: Record<string, string> | null | undefined;
7
- };
8
- export declare const frontmatterString: (context: object) => string;
9
4
  export declare const mdPath: (dir: string) => string;
10
- export declare const mdContextPath: (dir: string) => string;
5
+ export declare const jsonPath: (dir: string) => string;
@@ -1,4 +1,4 @@
1
1
  import type { MdxJsxAttribute, MdxJsxExpressionAttribute } from 'mdast-util-mdx-jsx';
2
2
  import type { TinaField } from '@tinacms/schema-tools';
3
- export declare const extractAttributes: (attributes: (MdxJsxAttribute | MdxJsxExpressionAttribute)[], fields: TinaField[], imageCallback: (image: string) => string, context: Record<string, unknown> | undefined) => Record<string, unknown>;
3
+ export declare const extractAttributes: (attributes: (MdxJsxAttribute | MdxJsxExpressionAttribute)[], fields: TinaField[], imageCallback: (image: string) => string) => Record<string, unknown>;
4
4
  export declare const trimFragments: (string: string) => string;
@@ -3,9 +3,9 @@
3
3
 
4
4
 
5
5
  */
6
- import { RichTextParseError } from './remarkToPlate';
7
6
  import type { RichTextType } from '@tinacms/schema-tools';
8
7
  import type * as Plate from './plate';
8
+ import { RichTextParseError } from './remarkToPlate';
9
9
  /**
10
10
  * ### Convert the MDXAST into an API-friendly format
11
11
  *
@@ -57,10 +57,8 @@ import type * as Plate from './plate';
57
57
  */
58
58
  export declare const markdownToAst: (value: string, field: RichTextType) => import("mdast").Root;
59
59
  export declare const mdxToAst: (value: string) => import("mdast").Root;
60
- export declare const MDX_PARSE_ERROR_MSG = "TinaCMS supports a stricter version of markdown and a subset of MDX. https://tina.io/docs/editing/mdx/#differences-from-other-mdx-implementations";
61
- export declare const MDX_PARSE_ERROR_MSG_HTML = "TinaCMS supports a stricter version of markdown and a subset of MDX. <a href=\"https://tina.io/docs/editing/mdx/#differences-from-other-mdx-implementations\" target=\"_blank\" rel=\"noopener noreferrer\">Learn More</a>";
62
- export declare const parseMDX: (value: string, field: RichTextType, imageCallback: (s: string) => string, context?: {
63
- _tinaEmbeds?: Record<string, string> | null | undefined;
64
- }) => Plate.RootElement;
60
+ export declare const MDX_PARSE_ERROR_MSG = "TinaCMS supports a stricter version of markdown and a subset of MDX. https://tina.io/docs/r/what-is-markdown";
61
+ export declare const MDX_PARSE_ERROR_MSG_HTML = "TinaCMS supports a stricter version of markdown and a subset of MDX. <a href=\"https://tina.io/docs/r/what-is-markdown\" target=\"_blank\" rel=\"noopener noreferrer\">Learn More</a>";
62
+ export declare const parseMDX: (value: string, field: RichTextType, imageCallback: (s: string) => string) => Plate.RootElement;
65
63
  export declare const invalidMarkdown: (e: RichTextParseError, value: string) => Plate.RootElement;
66
64
  export declare const replaceAll: (string: string, target: string, value: string) => string;
@@ -8,6 +8,6 @@ import type { RichTextType } from '@tinacms/schema-tools';
8
8
  import type * as Plate from './plate';
9
9
  import { ContainerDirective } from 'mdast-util-directive';
10
10
  import { LeafDirective } from 'mdast-util-directive/lib';
11
- export declare function mdxJsxElement(node: MdxJsxTextElement, field: RichTextType, imageCallback: (url: string) => string, context?: Record<string, unknown>): Plate.MdxInlineElement;
12
- export declare function mdxJsxElement(node: MdxJsxFlowElement, field: RichTextType, imageCallback: (url: string) => string, context?: Record<string, unknown>): Plate.MdxBlockElement;
11
+ export declare function mdxJsxElement(node: MdxJsxTextElement, field: RichTextType, imageCallback: (url: string) => string): Plate.MdxInlineElement;
12
+ export declare function mdxJsxElement(node: MdxJsxFlowElement, field: RichTextType, imageCallback: (url: string) => string): Plate.MdxBlockElement;
13
13
  export declare const directiveElement: (node: ContainerDirective | LeafDirective, field: RichTextType, imageCallback: (url: string) => string, raw?: string) => Plate.BlockElement | Plate.ParagraphElement;
@@ -9,7 +9,6 @@
9
9
  export type RootElement = {
10
10
  type: 'root';
11
11
  children: BlockElement[];
12
- embedCode?: string;
13
12
  };
14
13
  /**
15
14
  * @group BlockElement
@@ -18,14 +17,17 @@ export type BlockquoteElement = {
18
17
  type: 'blockquote';
19
18
  children: InlineElement[];
20
19
  };
21
- /**
22
- * @group BlockElement
23
- */
20
+ export type CodeLineElement = {
21
+ type: 'code_line';
22
+ children: {
23
+ text: string;
24
+ }[];
25
+ };
24
26
  export type CodeBlockElement = {
25
27
  type: 'code_block';
26
28
  lang?: string;
27
- value: string;
28
- children: [EmptyTextElement];
29
+ value?: string;
30
+ children: CodeLineElement[];
29
31
  };
30
32
  /**
31
33
  * @group BlockElement
@@ -141,18 +143,10 @@ export type TableElement = {
141
143
  children: TableRowElement[];
142
144
  props: Record<string, unknown>;
143
145
  };
144
- /**
145
- * @group MermaidElement
146
- */
147
- export type MermaidElement = {
148
- type: 'mermaid';
149
- value: string;
150
- children: [EmptyTextElement];
151
- };
152
146
  /**
153
147
  * @group BlockElement
154
148
  */
155
- export type BlockElement = BlockquoteElement | CodeBlockElement | HeadingElement | HrElement | HTMLElement | ImageElement | InvalidMarkdownElement | ListItemElement | MdxBlockElement | ParagraphElement | MermaidElement | OrderedListElement | UnorderedListElement | TableCellElement | TableRowElement | TableElement;
149
+ export type BlockElement = BlockquoteElement | CodeBlockElement | HeadingElement | HrElement | HTMLElement | ImageElement | InvalidMarkdownElement | ListItemElement | MdxBlockElement | ParagraphElement | OrderedListElement | UnorderedListElement | TableCellElement | TableRowElement | TableElement;
156
150
  /**
157
151
  * @group InlineElement
158
152
  */
@@ -182,6 +176,7 @@ export type TextElement = {
182
176
  bold?: boolean;
183
177
  italic?: boolean;
184
178
  code?: boolean;
179
+ strikethrough?: boolean;
185
180
  };
186
181
  /**
187
182
  * @remarks
@@ -3,11 +3,11 @@
3
3
 
4
4
 
5
5
  */
6
- import type * as Md from 'mdast';
7
- import type * as Plate from './plate';
8
6
  import type { RichTextType } from '@tinacms/schema-tools';
9
- import type { MdxJsxTextElement, MdxJsxFlowElement } from 'mdast-util-mdx-jsx';
7
+ import type * as Md from 'mdast';
10
8
  import type { ContainerDirective } from 'mdast-util-directive';
9
+ import type { MdxJsxFlowElement, MdxJsxTextElement } from 'mdast-util-mdx-jsx';
10
+ import type * as Plate from './plate';
11
11
  export type { Position, PositionItem } from './plate';
12
12
  declare module 'mdast' {
13
13
  interface StaticPhrasingContentMap {
@@ -23,7 +23,7 @@ declare module 'mdast' {
23
23
  mdxJsxFlowElement: MdxJsxFlowElement;
24
24
  }
25
25
  }
26
- export declare const remarkToSlate: (root: Md.Root | MdxJsxFlowElement | MdxJsxTextElement | ContainerDirective, field: RichTextType, imageCallback: (url: string) => string, raw?: string, skipMDXProcess?: boolean, context?: Record<string, unknown>) => Plate.RootElement;
26
+ export declare const remarkToSlate: (root: Md.Root | MdxJsxFlowElement | MdxJsxTextElement | ContainerDirective, field: RichTextType, imageCallback: (url: string) => string, raw?: string, skipMDXProcess?: boolean) => Plate.RootElement;
27
27
  export declare class RichTextParseError extends Error {
28
28
  position?: Plate.Position;
29
29
  constructor(message: string, position?: Plate.Position);
@@ -1,18 +1,18 @@
1
1
  import type { RichTextField } from '@tinacms/schema-tools';
2
+ import type * as Md from 'mdast';
2
3
  import type { MdxJsxAttribute } from 'mdast-util-mdx-jsx';
3
4
  import * as Plate from '../parse/plate';
4
- import type * as Md from 'mdast';
5
- export declare const stringifyPropsInline: (element: Plate.MdxInlineElement, field: RichTextField, imageCallback: (url: string) => string, context?: Record<string, any>) => {
5
+ export declare const stringifyPropsInline: (element: Plate.MdxInlineElement, field: RichTextField, imageCallback: (url: string) => string) => {
6
6
  attributes: MdxJsxAttribute[];
7
7
  children: Md.PhrasingContent[];
8
8
  };
9
- export declare function stringifyProps(element: Plate.MdxInlineElement, parentField: RichTextField, flatten: boolean, imageCallback: (url: string) => string, context: Record<string, any>): {
9
+ export declare function stringifyProps(element: Plate.MdxInlineElement, parentField: RichTextField, flatten: boolean, imageCallback: (url: string) => string): {
10
10
  attributes: MdxJsxAttribute[];
11
11
  children: Md.PhrasingContent[];
12
12
  useDirective: boolean;
13
13
  directiveType: string;
14
14
  };
15
- export declare function stringifyProps(element: Plate.MdxBlockElement, parentField: RichTextField, flatten: boolean, imageCallback: (url: string) => string, context: Record<string, any>): {
15
+ export declare function stringifyProps(element: Plate.MdxBlockElement, parentField: RichTextField, flatten: boolean, imageCallback: (url: string) => string): {
16
16
  attributes: MdxJsxAttribute[];
17
17
  children: Md.BlockContent[];
18
18
  useDirective: boolean;
@@ -1,11 +1,6 @@
1
- /**
2
-
3
-
4
-
5
- */
6
- import { MdxJsxTextElement, MdxJsxFlowElement } from 'mdast-util-mdx-jsx';
7
1
  import type { RichTextType } from '@tinacms/schema-tools';
8
2
  import type * as Md from 'mdast';
3
+ import { MdxJsxFlowElement, MdxJsxTextElement } from 'mdast-util-mdx-jsx';
9
4
  import type * as Plate from '../parse/plate';
10
5
  declare module 'mdast' {
11
6
  interface StaticPhrasingContentMap {
@@ -21,7 +16,7 @@ declare module 'mdast' {
21
16
  mdxJsxFlowElement: MdxJsxFlowElement;
22
17
  }
23
18
  }
24
- export declare const stringifyMDX: (value: Plate.RootElement, field: RichTextType, imageCallback: (url: string) => string, context?: Record<string, any>) => string | undefined;
19
+ export declare const serializeMDX: (value: Plate.RootElement, field: RichTextType, imageCallback: (url: string) => string) => string | Plate.RootElement | undefined;
25
20
  export type Pattern = {
26
21
  start: string;
27
22
  end: string;
@@ -30,7 +25,8 @@ export type Pattern = {
30
25
  type: 'block' | 'leaf';
31
26
  };
32
27
  export declare const toTinaMarkdown: (tree: Md.Root, field: RichTextType) => string;
33
- export declare const rootElement: (content: Plate.RootElement, field: RichTextType, imageCallback: (url: string) => string, context: Record<string, any>) => Md.Root;
34
- export declare const blockElement: (content: Plate.BlockElement, field: RichTextType, imageCallback: (url: string) => string, context: Record<string, any>) => Md.Content | null;
35
- export type Marks = 'strong' | 'emphasis' | 'inlineCode';
28
+ export declare const rootElement: (content: Plate.RootElement, field: RichTextType, imageCallback: (url: string) => string) => Md.Root;
29
+ export declare function codeLinesToString(content: Plate.CodeBlockElement): string;
30
+ export declare const blockElement: (content: Plate.BlockElement, field: RichTextType, imageCallback: (url: string) => string) => Md.Content | null;
31
+ export type Marks = 'strong' | 'emphasis' | 'inlineCode' | 'delete';
36
32
  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": "0.0.0-cef656e-20250119001929",
3
+ "version": "0.0.0-d1bd1a1-20251124051649",
4
4
  "typings": "dist/index.d.ts",
5
5
  "main": "dist/index.js",
6
6
  "browser": "dist/index.browser.mjs",
@@ -30,7 +30,6 @@
30
30
  "acorn": "8.8.2",
31
31
  "ccount": "2.0.1",
32
32
  "estree-util-is-identifier-name": "2.1.0",
33
- "lodash.flatten": "4.4.0",
34
33
  "mdast-util-compact": "4.1.1",
35
34
  "mdast-util-directive": "2.2.4",
36
35
  "mdast-util-from-markdown": "1.3.0",
@@ -56,7 +55,7 @@
56
55
  "unist-util-visit": "4.1.2",
57
56
  "uvu": "0.5.6",
58
57
  "vfile-message": "3.1.4",
59
- "@tinacms/schema-tools": "1.7.0"
58
+ "@tinacms/schema-tools": "0.0.0-d1bd1a1-20251124051649"
60
59
  },
61
60
  "publishConfig": {
62
61
  "registry": "https://registry.npmjs.org"
@@ -67,25 +66,19 @@
67
66
  },
68
67
  "devDependencies": {
69
68
  "@types/estree": "1.0.0",
70
- "@types/js-yaml": "^4.0.9",
71
- "@types/lodash.flatten": "^4.4.9",
72
69
  "@types/mdast": "^3.0.15",
73
- "@types/node": "^22.9.0",
70
+ "@types/node": "^22.13.1",
74
71
  "@types/prettier": "^2.7.3",
75
72
  "@types/unist": "^2.0.11",
76
73
  "c8": "^7.14.0",
77
74
  "concat-md": "^0.5.1",
78
75
  "jest-file-snapshot": "^0.5.0",
79
- "js-yaml": "^4.1.0",
80
- "mdast-util-frontmatter": "1.0.1",
81
- "micromark-extension-frontmatter": "1.1.0",
82
76
  "ts-node": "^10.9.2",
83
77
  "typedoc-plugin-markdown": "^3.17.1",
84
- "typescript": "^5.6.3",
85
- "vite": "^4.5.5",
78
+ "typescript": "^5.7.3",
79
+ "vite": "^4.5.9",
86
80
  "vitest": "^0.32.4",
87
- "zod": "^3.23.8",
88
- "@tinacms/scripts": "1.3.1"
81
+ "@tinacms/scripts": "0.0.0-d1bd1a1-20251124051649"
89
82
  },
90
83
  "scripts": {
91
84
  "types": "tsc",