@tinacms/mdx 0.0.0-8434fe2-20241004062927 → 0.0.0-899eda4-20250227042836
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.browser.mjs +4067 -3522
- package/dist/index.js +4152 -3604
- package/dist/index.mjs +4064 -3521
- package/dist/next/stringify/pre-processing.d.ts +0 -2
- package/dist/next/tests/markdown-basic-marks-strikethrough/field.d.ts +2 -0
- package/dist/next/tests/markdown-basic-marks-strikethrough/index.test.d.ts +1 -0
- package/dist/next/tests/mdx-local-variables/field.d.ts +2 -0
- package/dist/next/tests/mdx-local-variables/index.test.d.ts +1 -0
- package/dist/next/tests/util.d.ts +6 -0
- package/dist/parse/acorn.d.ts +1 -1
- package/dist/parse/index.d.ts +3 -1
- package/dist/parse/mdx.d.ts +2 -2
- package/dist/parse/plate.d.ts +25 -1
- package/dist/parse/remarkToPlate.d.ts +2 -1
- package/dist/parse/remarkToPlate.test.d.ts +1 -0
- package/dist/stringify/acorn.d.ts +3 -3
- package/dist/stringify/index.d.ts +4 -4
- package/package.json +16 -11
|
@@ -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 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,4 +1,10 @@
|
|
|
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;
|
|
4
9
|
export declare const mdPath: (dir: string) => string;
|
|
10
|
+
export declare const mdContextPath: (dir: string) => string;
|
package/dist/parse/acorn.d.ts
CHANGED
|
@@ -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) => Record<string, unknown>;
|
|
3
|
+
export declare const extractAttributes: (attributes: (MdxJsxAttribute | MdxJsxExpressionAttribute)[], fields: TinaField[], imageCallback: (image: string) => string, context: Record<string, unknown> | undefined) => Record<string, unknown>;
|
|
4
4
|
export declare const trimFragments: (string: string) => string;
|
package/dist/parse/index.d.ts
CHANGED
|
@@ -59,6 +59,8 @@ export declare const markdownToAst: (value: string, field: RichTextType) => impo
|
|
|
59
59
|
export declare const mdxToAst: (value: string) => import("mdast").Root;
|
|
60
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
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
|
|
62
|
+
export declare const parseMDX: (value: string, field: RichTextType, imageCallback: (s: string) => string, context?: {
|
|
63
|
+
_tinaEmbeds?: Record<string, string> | null | undefined;
|
|
64
|
+
}) => Plate.RootElement;
|
|
63
65
|
export declare const invalidMarkdown: (e: RichTextParseError, value: string) => Plate.RootElement;
|
|
64
66
|
export declare const replaceAll: (string: string, target: string, value: string) => string;
|
package/dist/parse/mdx.d.ts
CHANGED
|
@@ -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): Plate.MdxInlineElement;
|
|
12
|
-
export declare function mdxJsxElement(node: MdxJsxFlowElement, field: RichTextType, imageCallback: (url: string) => string): Plate.MdxBlockElement;
|
|
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;
|
|
13
13
|
export declare const directiveElement: (node: ContainerDirective | LeafDirective, field: RichTextType, imageCallback: (url: string) => string, raw?: string) => Plate.BlockElement | Plate.ParagraphElement;
|
package/dist/parse/plate.d.ts
CHANGED
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
export type RootElement = {
|
|
10
10
|
type: 'root';
|
|
11
11
|
children: BlockElement[];
|
|
12
|
+
embedCode?: string;
|
|
12
13
|
};
|
|
13
14
|
/**
|
|
14
15
|
* @group BlockElement
|
|
@@ -118,6 +119,28 @@ export type ParagraphElement = {
|
|
|
118
119
|
type: 'p';
|
|
119
120
|
children: InlineElement[];
|
|
120
121
|
};
|
|
122
|
+
/**
|
|
123
|
+
* @group BlockElement
|
|
124
|
+
*/
|
|
125
|
+
export type TableCellElement = {
|
|
126
|
+
type: 'td';
|
|
127
|
+
children: ParagraphElement[];
|
|
128
|
+
};
|
|
129
|
+
/**
|
|
130
|
+
* @group BlockElement
|
|
131
|
+
*/
|
|
132
|
+
export type TableRowElement = {
|
|
133
|
+
type: 'tr';
|
|
134
|
+
children: TableCellElement[];
|
|
135
|
+
};
|
|
136
|
+
/**
|
|
137
|
+
* @group BlockElement
|
|
138
|
+
*/
|
|
139
|
+
export type TableElement = {
|
|
140
|
+
type: 'table';
|
|
141
|
+
children: TableRowElement[];
|
|
142
|
+
props: Record<string, unknown>;
|
|
143
|
+
};
|
|
121
144
|
/**
|
|
122
145
|
* @group MermaidElement
|
|
123
146
|
*/
|
|
@@ -129,7 +152,7 @@ export type MermaidElement = {
|
|
|
129
152
|
/**
|
|
130
153
|
* @group BlockElement
|
|
131
154
|
*/
|
|
132
|
-
export type BlockElement = BlockquoteElement | CodeBlockElement | HeadingElement | HrElement | HTMLElement | ImageElement | InvalidMarkdownElement | ListItemElement | MdxBlockElement | ParagraphElement | MermaidElement | OrderedListElement | UnorderedListElement;
|
|
155
|
+
export type BlockElement = BlockquoteElement | CodeBlockElement | HeadingElement | HrElement | HTMLElement | ImageElement | InvalidMarkdownElement | ListItemElement | MdxBlockElement | ParagraphElement | MermaidElement | OrderedListElement | UnorderedListElement | TableCellElement | TableRowElement | TableElement;
|
|
133
156
|
/**
|
|
134
157
|
* @group InlineElement
|
|
135
158
|
*/
|
|
@@ -159,6 +182,7 @@ export type TextElement = {
|
|
|
159
182
|
bold?: boolean;
|
|
160
183
|
italic?: boolean;
|
|
161
184
|
code?: boolean;
|
|
185
|
+
strikethrough?: boolean;
|
|
162
186
|
};
|
|
163
187
|
/**
|
|
164
188
|
* @remarks
|
|
@@ -23,8 +23,9 @@ 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) => Plate.RootElement;
|
|
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;
|
|
27
27
|
export declare class RichTextParseError extends Error {
|
|
28
28
|
position?: Plate.Position;
|
|
29
29
|
constructor(message: string, position?: Plate.Position);
|
|
30
30
|
}
|
|
31
|
+
export declare const sanitizeUrl: (url: string | undefined) => string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -2,17 +2,17 @@ import type { RichTextField } from '@tinacms/schema-tools';
|
|
|
2
2
|
import type { MdxJsxAttribute } from 'mdast-util-mdx-jsx';
|
|
3
3
|
import * as Plate from '../parse/plate';
|
|
4
4
|
import type * as Md from 'mdast';
|
|
5
|
-
export declare const stringifyPropsInline: (element: Plate.MdxInlineElement, field: RichTextField, imageCallback: (url: string) => string) => {
|
|
5
|
+
export declare const stringifyPropsInline: (element: Plate.MdxInlineElement, field: RichTextField, imageCallback: (url: string) => string, context?: Record<string, any>) => {
|
|
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): {
|
|
9
|
+
export declare function stringifyProps(element: Plate.MdxInlineElement, parentField: RichTextField, flatten: boolean, imageCallback: (url: string) => string, context: Record<string, any>): {
|
|
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): {
|
|
15
|
+
export declare function stringifyProps(element: Plate.MdxBlockElement, parentField: RichTextField, flatten: boolean, imageCallback: (url: string) => string, context: Record<string, any>): {
|
|
16
16
|
attributes: MdxJsxAttribute[];
|
|
17
17
|
children: Md.BlockContent[];
|
|
18
18
|
useDirective: boolean;
|
|
@@ -21,7 +21,7 @@ declare module 'mdast' {
|
|
|
21
21
|
mdxJsxFlowElement: MdxJsxFlowElement;
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
|
-
export declare const stringifyMDX: (value: Plate.RootElement, field: RichTextType, imageCallback: (url: string) => string) => string | undefined;
|
|
24
|
+
export declare const stringifyMDX: (value: Plate.RootElement, field: RichTextType, imageCallback: (url: string) => string, context?: Record<string, any>) => string | undefined;
|
|
25
25
|
export type Pattern = {
|
|
26
26
|
start: string;
|
|
27
27
|
end: string;
|
|
@@ -30,7 +30,7 @@ export type Pattern = {
|
|
|
30
30
|
type: 'block' | 'leaf';
|
|
31
31
|
};
|
|
32
32
|
export declare const toTinaMarkdown: (tree: Md.Root, field: RichTextType) => string;
|
|
33
|
-
export declare const rootElement: (content: Plate.RootElement, field: RichTextType, imageCallback: (url: string) => string) => Md.Root;
|
|
34
|
-
export declare const blockElement: (content: Plate.BlockElement, field: RichTextType, imageCallback: (url: string) => string) => Md.Content | null;
|
|
35
|
-
export type Marks = 'strong' | 'emphasis' | 'inlineCode';
|
|
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' | '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": "0.0.0-
|
|
3
|
+
"version": "0.0.0-899eda4-20250227042836",
|
|
4
4
|
"typings": "dist/index.d.ts",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"browser": "dist/index.browser.mjs",
|
|
@@ -11,9 +11,9 @@
|
|
|
11
11
|
],
|
|
12
12
|
"exports": {
|
|
13
13
|
".": {
|
|
14
|
+
"browser": "./dist/index.browser.mjs",
|
|
14
15
|
"import": "./dist/index.mjs",
|
|
15
|
-
"require": "./dist/index.js"
|
|
16
|
-
"browser": "./dist/index.browser.mjs"
|
|
16
|
+
"require": "./dist/index.js"
|
|
17
17
|
}
|
|
18
18
|
},
|
|
19
19
|
"license": "Apache-2.0",
|
|
@@ -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.
|
|
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-
|
|
59
|
+
"@tinacms/schema-tools": "0.0.0-899eda4-20250227042836"
|
|
60
60
|
},
|
|
61
61
|
"publishConfig": {
|
|
62
62
|
"registry": "https://registry.npmjs.org"
|
|
@@ -67,28 +67,33 @@
|
|
|
67
67
|
},
|
|
68
68
|
"devDependencies": {
|
|
69
69
|
"@types/estree": "1.0.0",
|
|
70
|
+
"@types/js-yaml": "^4.0.9",
|
|
70
71
|
"@types/lodash.flatten": "^4.4.9",
|
|
71
72
|
"@types/mdast": "^3.0.15",
|
|
72
|
-
"@types/node": "^22.
|
|
73
|
+
"@types/node": "^22.13.1",
|
|
73
74
|
"@types/prettier": "^2.7.3",
|
|
74
75
|
"@types/unist": "^2.0.11",
|
|
75
76
|
"c8": "^7.14.0",
|
|
76
77
|
"concat-md": "^0.5.1",
|
|
77
78
|
"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",
|
|
78
82
|
"ts-node": "^10.9.2",
|
|
79
83
|
"typedoc-plugin-markdown": "^3.17.1",
|
|
80
|
-
"typescript": "^5.
|
|
81
|
-
"vite": "^4.5.
|
|
84
|
+
"typescript": "^5.7.3",
|
|
85
|
+
"vite": "^4.5.9",
|
|
82
86
|
"vitest": "^0.32.4",
|
|
83
|
-
"
|
|
87
|
+
"zod": "^3.23.8",
|
|
88
|
+
"@tinacms/scripts": "1.3.2"
|
|
84
89
|
},
|
|
85
90
|
"scripts": {
|
|
86
91
|
"types": "tsc",
|
|
87
92
|
"build": "tinacms-scripts build",
|
|
88
93
|
"docs": "typedoc --plugin typedoc-plugin-markdown src/parse/plate.ts --theme markdown && concat-md --decrease-title-levels --dir-name-as-title docs > spec.md",
|
|
89
94
|
"serve": "nodemon dist/server.js",
|
|
90
|
-
"test": "vitest",
|
|
95
|
+
"test": "vitest run",
|
|
91
96
|
"coverage": "vitest run --coverage",
|
|
92
|
-
"test-watch": "
|
|
97
|
+
"test-watch": "vitest"
|
|
93
98
|
}
|
|
94
99
|
}
|