@tinacms/mdx 1.3.27 → 1.3.28
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/next/parse/index.d.ts +1 -1
- package/dist/next/shortcodes/lib/syntax.d.ts +2 -2
- package/dist/next/shortcodes/mdast/index.d.ts +11 -11
- package/dist/next/stringify/marks.d.ts +1 -1
- package/dist/next/stringify/pre-processing.d.ts +1 -1
- package/dist/parse/mdx.d.ts +1 -1
- package/dist/parse/plate.d.ts +27 -27
- package/dist/parse/remarkToPlate.d.ts +1 -1
- package/dist/stringify/index.d.ts +2 -2
- package/dist/stringify/marks.d.ts +1 -1
- package/package.json +4 -4
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { RichTextField } from '@tinacms/schema-tools';
|
|
2
|
-
export declare const parseMDX: (value: string, field: RichTextField, imageCallback?: (
|
|
2
|
+
export declare const parseMDX: (value: string, field: RichTextField, imageCallback?: (s: string) => string) => import("../..").RootElement;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Extension } from 'micromark-util-types';
|
|
2
2
|
import type { Acorn, AcornOptions } from 'micromark-factory-mdx-expression';
|
|
3
|
-
export
|
|
3
|
+
export type Pattern = {
|
|
4
4
|
start: string;
|
|
5
5
|
end: string;
|
|
6
6
|
name: string;
|
|
@@ -8,7 +8,7 @@ export declare type Pattern = {
|
|
|
8
8
|
type: 'inline' | 'flow';
|
|
9
9
|
leaf: boolean;
|
|
10
10
|
};
|
|
11
|
-
export
|
|
11
|
+
export type Options = {
|
|
12
12
|
acorn?: Acorn;
|
|
13
13
|
acornOptions?: AcornOptions;
|
|
14
14
|
patterns?: Pattern[];
|
|
@@ -83,24 +83,24 @@ export declare const mdxJsxToMarkdown: (options: Options & {
|
|
|
83
83
|
resourceLink: boolean;
|
|
84
84
|
bullet?: "-" | "*" | "+" | null | undefined;
|
|
85
85
|
bulletOther?: "-" | "*" | "+" | null | undefined;
|
|
86
|
-
bulletOrdered?: "
|
|
87
|
-
bulletOrderedOther?: "
|
|
86
|
+
bulletOrdered?: "." | ")" | null | undefined;
|
|
87
|
+
bulletOrderedOther?: "." | ")" | null | undefined;
|
|
88
88
|
closeAtx?: boolean | null | undefined;
|
|
89
|
-
emphasis?: "
|
|
90
|
-
fence?: "
|
|
89
|
+
emphasis?: "_" | "*" | null | undefined;
|
|
90
|
+
fence?: "~" | "`" | null | undefined;
|
|
91
91
|
incrementListMarker?: boolean | null | undefined;
|
|
92
92
|
listItemIndent?: "tab" | "one" | "mixed" | null | undefined;
|
|
93
93
|
quote?: "\"" | "'" | null | undefined;
|
|
94
|
-
rule?: "-" | "
|
|
94
|
+
rule?: "-" | "_" | "*" | null | undefined;
|
|
95
95
|
ruleRepetition?: number | null | undefined;
|
|
96
96
|
ruleSpaces?: boolean | null | undefined;
|
|
97
97
|
setext?: boolean | null | undefined;
|
|
98
|
-
strong?: "
|
|
98
|
+
strong?: "_" | "*" | null | undefined;
|
|
99
99
|
tightDefinitions?: boolean | null | undefined;
|
|
100
|
-
join?: import("mdast-util-to-markdown").Join
|
|
101
|
-
extensions?: Options
|
|
102
|
-
printWidth?: number
|
|
103
|
-
quoteSmart?: boolean
|
|
104
|
-
tightSelfClosing?: boolean
|
|
100
|
+
join?: Array<import("mdast-util-to-markdown").Join> | null | undefined;
|
|
101
|
+
extensions?: Array<Options> | null | undefined;
|
|
102
|
+
printWidth?: number;
|
|
103
|
+
quoteSmart?: boolean;
|
|
104
|
+
tightSelfClosing?: boolean;
|
|
105
105
|
patterns: Pattern[];
|
|
106
106
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type * as Md from 'mdast';
|
|
2
2
|
import type * as Plate from '../../parse/plate';
|
|
3
3
|
import type { RichTextField } from '@tinacms/schema-tools';
|
|
4
|
-
|
|
4
|
+
type InlineElementWithCallback = Plate.InlineElement & {
|
|
5
5
|
linkifyTextNode?: (arg: Md.Text) => Md.Link;
|
|
6
6
|
};
|
|
7
7
|
export declare const eat: (c: InlineElementWithCallback[], field: RichTextField, imageCallback: (url: string) => string) => Md.PhrasingContent[];
|
|
@@ -5,5 +5,5 @@ 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
|
|
8
|
+
export type Marks = 'strong' | 'emphasis' | 'inlineCode';
|
|
9
9
|
export declare const getMarks: (content: Plate.InlineElement) => Marks[];
|
package/dist/parse/mdx.d.ts
CHANGED
|
@@ -10,4 +10,4 @@ import { ContainerDirective } from 'mdast-util-directive';
|
|
|
10
10
|
import { LeafDirective } from 'mdast-util-directive/lib';
|
|
11
11
|
export declare function mdxJsxElement(node: MdxJsxTextElement, field: RichTextType, imageCallback: (url: string) => string): Plate.MdxInlineElement;
|
|
12
12
|
export declare function mdxJsxElement(node: MdxJsxFlowElement, field: RichTextType, imageCallback: (url: string) => string): Plate.MdxBlockElement;
|
|
13
|
-
export declare const directiveElement: (node: ContainerDirective | LeafDirective, field: RichTextType, imageCallback: (url: string) => string, raw?: string
|
|
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
|
@@ -6,21 +6,21 @@
|
|
|
6
6
|
/**
|
|
7
7
|
* @group _MiscellaneousElement
|
|
8
8
|
*/
|
|
9
|
-
export
|
|
9
|
+
export type RootElement = {
|
|
10
10
|
type: 'root';
|
|
11
11
|
children: BlockElement[];
|
|
12
12
|
};
|
|
13
13
|
/**
|
|
14
14
|
* @group BlockElement
|
|
15
15
|
*/
|
|
16
|
-
export
|
|
16
|
+
export type BlockquoteElement = {
|
|
17
17
|
type: 'blockquote';
|
|
18
18
|
children: InlineElement[];
|
|
19
19
|
};
|
|
20
20
|
/**
|
|
21
21
|
* @group BlockElement
|
|
22
22
|
*/
|
|
23
|
-
export
|
|
23
|
+
export type CodeBlockElement = {
|
|
24
24
|
type: 'code_block';
|
|
25
25
|
lang?: string;
|
|
26
26
|
value: string;
|
|
@@ -29,21 +29,21 @@ export declare type CodeBlockElement = {
|
|
|
29
29
|
/**
|
|
30
30
|
* @group BlockElement
|
|
31
31
|
*/
|
|
32
|
-
export
|
|
32
|
+
export type HeadingElement = {
|
|
33
33
|
type: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
|
|
34
34
|
children: InlineElement[];
|
|
35
35
|
};
|
|
36
36
|
/**
|
|
37
37
|
* @group BlockElement
|
|
38
38
|
*/
|
|
39
|
-
export
|
|
39
|
+
export type HrElement = {
|
|
40
40
|
type: 'hr';
|
|
41
41
|
children: [EmptyTextElement];
|
|
42
42
|
};
|
|
43
43
|
/**
|
|
44
44
|
* @group BlockElement
|
|
45
45
|
*/
|
|
46
|
-
export
|
|
46
|
+
export type HTMLElement = {
|
|
47
47
|
type: 'html';
|
|
48
48
|
value: string;
|
|
49
49
|
children: [EmptyTextElement];
|
|
@@ -51,7 +51,7 @@ export declare type HTMLElement = {
|
|
|
51
51
|
/**
|
|
52
52
|
* @group InlineElement
|
|
53
53
|
*/
|
|
54
|
-
export
|
|
54
|
+
export type HTMLInlineElement = {
|
|
55
55
|
type: 'html_inline';
|
|
56
56
|
value: string;
|
|
57
57
|
children: [EmptyTextElement];
|
|
@@ -59,7 +59,7 @@ export declare type HTMLInlineElement = {
|
|
|
59
59
|
/**
|
|
60
60
|
* @group BlockElement
|
|
61
61
|
*/
|
|
62
|
-
export
|
|
62
|
+
export type InvalidMarkdownElement = {
|
|
63
63
|
type: 'invalid_markdown';
|
|
64
64
|
value: string;
|
|
65
65
|
message: string;
|
|
@@ -69,36 +69,36 @@ export declare type InvalidMarkdownElement = {
|
|
|
69
69
|
/**
|
|
70
70
|
* @group ListElements
|
|
71
71
|
*/
|
|
72
|
-
export
|
|
72
|
+
export type List = OrderedListElement | UnorderedListElement;
|
|
73
73
|
/**
|
|
74
74
|
* @group ListElements
|
|
75
75
|
*/
|
|
76
|
-
export
|
|
76
|
+
export type ListItemContentElement = {
|
|
77
77
|
type: 'lic';
|
|
78
78
|
children: LicElement[];
|
|
79
79
|
};
|
|
80
80
|
/**
|
|
81
81
|
* @group ListElements
|
|
82
82
|
*/
|
|
83
|
-
export
|
|
83
|
+
export type ListItemChildrenElement = ListItemContentElement | UnorderedListElement | OrderedListElement;
|
|
84
84
|
/**
|
|
85
85
|
* @group BlockElement
|
|
86
86
|
*/
|
|
87
|
-
export
|
|
87
|
+
export type ListItemElement = {
|
|
88
88
|
type: 'li';
|
|
89
89
|
children: ListItemChildrenElement[];
|
|
90
90
|
};
|
|
91
91
|
/**
|
|
92
92
|
* @group BlockElement
|
|
93
93
|
*/
|
|
94
|
-
export
|
|
94
|
+
export type UnorderedListElement = {
|
|
95
95
|
type: 'ul';
|
|
96
96
|
children: ListItemElement[];
|
|
97
97
|
};
|
|
98
98
|
/**
|
|
99
99
|
* @group BlockElement
|
|
100
100
|
*/
|
|
101
|
-
export
|
|
101
|
+
export type MdxBlockElement = {
|
|
102
102
|
type: 'mdxJsxFlowElement';
|
|
103
103
|
name: string | null;
|
|
104
104
|
props: Record<string, unknown>;
|
|
@@ -107,25 +107,25 @@ export declare type MdxBlockElement = {
|
|
|
107
107
|
/**
|
|
108
108
|
* @group BlockElement
|
|
109
109
|
*/
|
|
110
|
-
export
|
|
110
|
+
export type OrderedListElement = {
|
|
111
111
|
type: 'ol';
|
|
112
112
|
children: ListItemElement[];
|
|
113
113
|
};
|
|
114
114
|
/**
|
|
115
115
|
* @group BlockElement
|
|
116
116
|
*/
|
|
117
|
-
export
|
|
117
|
+
export type ParagraphElement = {
|
|
118
118
|
type: 'p';
|
|
119
119
|
children: InlineElement[];
|
|
120
120
|
};
|
|
121
121
|
/**
|
|
122
122
|
* @group BlockElement
|
|
123
123
|
*/
|
|
124
|
-
export
|
|
124
|
+
export type BlockElement = BlockquoteElement | CodeBlockElement | HeadingElement | HrElement | HTMLElement | ImageElement | InvalidMarkdownElement | ListItemElement | MdxBlockElement | ParagraphElement | OrderedListElement | UnorderedListElement;
|
|
125
125
|
/**
|
|
126
126
|
* @group InlineElement
|
|
127
127
|
*/
|
|
128
|
-
export
|
|
128
|
+
export type MdxInlineElement = {
|
|
129
129
|
type: 'mdxJsxTextElement';
|
|
130
130
|
name: string | null;
|
|
131
131
|
props: Record<string, unknown>;
|
|
@@ -138,14 +138,14 @@ export declare type MdxInlineElement = {
|
|
|
138
138
|
*
|
|
139
139
|
* @group MiscellaneousElement
|
|
140
140
|
*/
|
|
141
|
-
export
|
|
141
|
+
export type EmptyTextElement = {
|
|
142
142
|
type: 'text';
|
|
143
143
|
text: '';
|
|
144
144
|
};
|
|
145
145
|
/**
|
|
146
146
|
* @group InlineElement
|
|
147
147
|
*/
|
|
148
|
-
export
|
|
148
|
+
export type TextElement = {
|
|
149
149
|
type: 'text';
|
|
150
150
|
text: string;
|
|
151
151
|
bold?: boolean;
|
|
@@ -158,7 +158,7 @@ export declare type TextElement = {
|
|
|
158
158
|
*
|
|
159
159
|
* @group InlineElement
|
|
160
160
|
*/
|
|
161
|
-
export
|
|
161
|
+
export type ImageElement = {
|
|
162
162
|
type: 'img';
|
|
163
163
|
url: string;
|
|
164
164
|
alt?: string;
|
|
@@ -168,7 +168,7 @@ export declare type ImageElement = {
|
|
|
168
168
|
/**
|
|
169
169
|
* @group InlineElement
|
|
170
170
|
*/
|
|
171
|
-
export
|
|
171
|
+
export type LinkElement = {
|
|
172
172
|
type: 'a';
|
|
173
173
|
url: string;
|
|
174
174
|
title?: string | null;
|
|
@@ -177,25 +177,25 @@ export declare type LinkElement = {
|
|
|
177
177
|
/**
|
|
178
178
|
* @group InlineElement
|
|
179
179
|
*/
|
|
180
|
-
export
|
|
180
|
+
export type BreakElement = {
|
|
181
181
|
type: 'break';
|
|
182
182
|
children: [EmptyTextElement];
|
|
183
183
|
};
|
|
184
184
|
/**
|
|
185
185
|
* @group ListElements
|
|
186
186
|
*/
|
|
187
|
-
export
|
|
187
|
+
export type LicElement = InlineElement;
|
|
188
188
|
/**
|
|
189
189
|
* @group InlineElement
|
|
190
190
|
*/
|
|
191
|
-
export
|
|
191
|
+
export type InlineElement = TextElement | MdxInlineElement | BreakElement | LinkElement | ImageElement | HTMLInlineElement;
|
|
192
192
|
/**
|
|
193
193
|
* @remarks
|
|
194
194
|
* Positional information for error reporting
|
|
195
195
|
*
|
|
196
196
|
* @group _MiscellaneousElement
|
|
197
197
|
*/
|
|
198
|
-
export
|
|
198
|
+
export type Position = {
|
|
199
199
|
start: PositionItem;
|
|
200
200
|
end: PositionItem;
|
|
201
201
|
};
|
|
@@ -205,7 +205,7 @@ export declare type Position = {
|
|
|
205
205
|
*
|
|
206
206
|
* @group _MiscellaneousElement
|
|
207
207
|
*/
|
|
208
|
-
export
|
|
208
|
+
export type PositionItem = {
|
|
209
209
|
line?: number | null;
|
|
210
210
|
column?: number | null;
|
|
211
211
|
offset?: number | null;
|
|
@@ -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
|
|
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);
|
|
@@ -22,7 +22,7 @@ declare module 'mdast' {
|
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
export declare const stringifyMDX: (value: Plate.RootElement, field: RichTextType, imageCallback: (url: string) => string) => string | undefined;
|
|
25
|
-
export
|
|
25
|
+
export type Pattern = {
|
|
26
26
|
start: string;
|
|
27
27
|
end: string;
|
|
28
28
|
name: string;
|
|
@@ -32,5 +32,5 @@ export declare 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
|
|
35
|
+
export type Marks = 'strong' | 'emphasis' | 'inlineCode';
|
|
36
36
|
export declare const getMarks: (content: Plate.InlineElement) => Marks[];
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
import type * as Md from 'mdast';
|
|
7
7
|
import type * as Plate from '../parse/plate';
|
|
8
8
|
import type { RichTextType } from '@tinacms/schema-tools';
|
|
9
|
-
|
|
9
|
+
type InlineElementWithCallback = Plate.InlineElement & {
|
|
10
10
|
linkifyTextNode?: (arg: Md.Text) => Md.Link;
|
|
11
11
|
};
|
|
12
12
|
export declare const eat: (c: InlineElementWithCallback[], field: RichTextType, imageCallback: (url: string) => string) => Md.PhrasingContent[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tinacms/mdx",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.28",
|
|
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.4.
|
|
59
|
+
"@tinacms/schema-tools": "1.4.19"
|
|
60
60
|
},
|
|
61
61
|
"publishConfig": {
|
|
62
62
|
"registry": "https://registry.npmjs.org"
|
|
@@ -77,10 +77,10 @@
|
|
|
77
77
|
"jest-file-snapshot": "^0.5.0",
|
|
78
78
|
"ts-node": "^10.8.2",
|
|
79
79
|
"typedoc-plugin-markdown": "^3.13.6",
|
|
80
|
-
"typescript": "^
|
|
80
|
+
"typescript": "^5.5.3",
|
|
81
81
|
"vite": "^4.3.9",
|
|
82
82
|
"vitest": "^0.32.2",
|
|
83
|
-
"@tinacms/scripts": "1.1.
|
|
83
|
+
"@tinacms/scripts": "1.1.6"
|
|
84
84
|
},
|
|
85
85
|
"scripts": {
|
|
86
86
|
"types": "tsc",
|