@tinacms/mdx 1.2.0 → 1.3.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.
- package/dist/extensions/tina-shortcodes/extension.d.ts +3 -0
- package/dist/extensions/tina-shortcodes/factory-attributes.d.ts +2 -0
- package/dist/extensions/tina-shortcodes/factory-name.d.ts +2 -0
- package/dist/extensions/tina-shortcodes/from-markdown.d.ts +2 -0
- package/dist/extensions/tina-shortcodes/shortcode-container.d.ts +3 -0
- package/dist/extensions/tina-shortcodes/shortcode-leaf.d.ts +5 -0
- package/dist/extensions/tina-shortcodes/to-markdown.d.ts +3 -0
- package/dist/index.es.js +1931 -904
- package/dist/index.js +10948 -6057
- package/dist/parse/index.d.ts +2 -2
- package/dist/parse/mdx.d.ts +3 -0
- package/dist/parse/remarkToPlate.d.ts +2 -1
- package/dist/stringify/acorn.d.ts +4 -0
- package/dist/stringify/index.d.ts +8 -0
- package/package.json +43 -2
- package/dist/tests/autotest/invalid mdx with a closing tag.test.d.ts +0 -1
- package/dist/tests/autotest/invalid mdx with a const expression.test.d.ts +0 -1
- package/dist/tests/autotest/invalid mdx with an expression {{}}.test.d.ts +0 -1
- package/dist/tests/autotest/invalid mdx with an expression.test.d.ts +0 -1
- package/dist/tests/autotest/invalid mdx with an import statement.test.d.ts +0 -1
- /package/dist/tests/{autotest → temp}/shortcodes.test.d.ts +0 -0
package/dist/parse/index.d.ts
CHANGED
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { RichTextParseError } from './remarkToPlate';
|
|
7
7
|
import type { RichTypeInner } from '@tinacms/schema-tools';
|
|
8
|
-
import type * as Md from 'mdast';
|
|
9
8
|
import type * as Plate from './plate';
|
|
10
9
|
/**
|
|
11
10
|
* ### Convert the MDXAST into an API-friendly format
|
|
@@ -56,7 +55,8 @@ import type * as Plate from './plate';
|
|
|
56
55
|
* 2. We don't need to do any client-side parsing. Since TinaMarkdown and the slate editor work with the same
|
|
57
56
|
* format we can just allow Tina to do it's thing and update the form value with no additional work.
|
|
58
57
|
*/
|
|
59
|
-
export declare const markdownToAst: (value: string, field: RichTypeInner) =>
|
|
58
|
+
export declare const markdownToAst: (value: string, field: RichTypeInner) => import("mdast").Root;
|
|
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
62
|
export declare const parseMDX: (value: string, field: RichTypeInner, imageCallback: (s: string) => string) => Plate.RootElement;
|
package/dist/parse/mdx.d.ts
CHANGED
|
@@ -6,5 +6,8 @@
|
|
|
6
6
|
import type { MdxJsxTextElement, MdxJsxFlowElement } from 'mdast-util-mdx-jsx';
|
|
7
7
|
import type { RichTypeInner } from '@tinacms/schema-tools';
|
|
8
8
|
import type * as Plate from './plate';
|
|
9
|
+
import { ContainerDirective } from 'mdast-util-directive';
|
|
10
|
+
import { LeafDirective } from 'mdast-util-directive/lib';
|
|
9
11
|
export declare function mdxJsxElement(node: MdxJsxTextElement, field: RichTypeInner, imageCallback: (url: string) => string): Plate.MdxInlineElement;
|
|
10
12
|
export declare function mdxJsxElement(node: MdxJsxFlowElement, field: RichTypeInner, imageCallback: (url: string) => string): Plate.MdxBlockElement;
|
|
13
|
+
export declare const directiveElement: (node: ContainerDirective | LeafDirective, field: RichTypeInner, imageCallback: (url: string) => string, raw?: string | undefined) => Plate.BlockElement | Plate.ParagraphElement;
|
|
@@ -7,6 +7,7 @@ import type * as Md from 'mdast';
|
|
|
7
7
|
import type * as Plate from './plate';
|
|
8
8
|
import type { RichTypeInner } from '@tinacms/schema-tools';
|
|
9
9
|
import type { MdxJsxTextElement, MdxJsxFlowElement } from 'mdast-util-mdx-jsx';
|
|
10
|
+
import { ContainerDirective } from 'mdast-util-directive';
|
|
10
11
|
export type { Position, PositionItem } from './plate';
|
|
11
12
|
declare module 'mdast' {
|
|
12
13
|
interface StaticPhrasingContentMap {
|
|
@@ -22,7 +23,7 @@ declare module 'mdast' {
|
|
|
22
23
|
mdxJsxFlowElement: MdxJsxFlowElement;
|
|
23
24
|
}
|
|
24
25
|
}
|
|
25
|
-
export declare const remarkToSlate: (root: Md.Root | MdxJsxFlowElement | MdxJsxTextElement, field: RichTypeInner, imageCallback: (url: string) => string) => Plate.RootElement;
|
|
26
|
+
export declare const remarkToSlate: (root: Md.Root | MdxJsxFlowElement | MdxJsxTextElement | ContainerDirective, field: RichTypeInner, imageCallback: (url: string) => string, raw?: string | undefined) => Plate.RootElement;
|
|
26
27
|
export declare class RichTextParseError extends Error {
|
|
27
28
|
position?: Plate.Position;
|
|
28
29
|
constructor(message: string, position?: Plate.Position);
|
|
@@ -9,9 +9,13 @@ export declare const stringifyPropsInline: (element: Plate.MdxInlineElement, fie
|
|
|
9
9
|
export declare function stringifyProps(element: Plate.MdxInlineElement, parentField: RichTypeInner, flatten: boolean, imageCallback: (url: string) => string): {
|
|
10
10
|
attributes: MdxJsxAttribute[];
|
|
11
11
|
children: Md.PhrasingContent[];
|
|
12
|
+
useDirective: boolean;
|
|
13
|
+
directiveType: string;
|
|
12
14
|
};
|
|
13
15
|
export declare function stringifyProps(element: Plate.MdxBlockElement, parentField: RichTypeInner, flatten: boolean, imageCallback: (url: string) => string): {
|
|
14
16
|
attributes: MdxJsxAttribute[];
|
|
15
17
|
children: Md.BlockContent[];
|
|
18
|
+
useDirective: boolean;
|
|
19
|
+
directiveType: string;
|
|
16
20
|
};
|
|
17
21
|
export declare function assertShape<T extends unknown>(value: unknown, callback: (item: any) => boolean, errorMessage?: string): asserts value is T;
|
|
@@ -22,6 +22,14 @@ declare module 'mdast' {
|
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
export declare const stringifyMDX: (value: Plate.RootElement, field: RichTypeInner, imageCallback: (url: string) => string) => string | undefined;
|
|
25
|
+
export declare type Pattern = {
|
|
26
|
+
start: string;
|
|
27
|
+
end: string;
|
|
28
|
+
name: string;
|
|
29
|
+
templateName: string;
|
|
30
|
+
type: 'block' | 'leaf';
|
|
31
|
+
};
|
|
32
|
+
export declare const toTinaMarkdown: (tree: Md.Root, field: RichTypeInner) => string;
|
|
25
33
|
export declare const rootElement: (content: Plate.RootElement, field: RichTypeInner, imageCallback: (url: string) => string) => Md.Root;
|
|
26
34
|
export declare const blockElement: (content: Plate.BlockElement, field: RichTypeInner, imageCallback: (url: string) => string) => Md.Content | null;
|
|
27
35
|
export declare type Marks = 'strong' | 'emphasis' | 'inlineCode';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tinacms/mdx",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.1",
|
|
4
4
|
"typings": "dist/index.d.ts",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.es.js",
|
|
@@ -23,18 +23,50 @@
|
|
|
23
23
|
]
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@tinacms/schema-tools": "1.3.
|
|
26
|
+
"@tinacms/schema-tools": "1.3.2",
|
|
27
|
+
"@types/mdast": "^3.0.10",
|
|
28
|
+
"@types/unist": "^2.0.6",
|
|
27
29
|
"acorn": "^8.7.1",
|
|
28
30
|
"concat-md": "^0.5.0",
|
|
29
31
|
"lodash-es": "^4.17.21",
|
|
32
|
+
"mdast": "^3.0.0",
|
|
33
|
+
"mdast-util-directive": "^2.2.2",
|
|
34
|
+
"mdast-util-from-markdown": "^1.3.0",
|
|
35
|
+
"mdast-util-frontmatter": "^1.0.0",
|
|
36
|
+
"mdast-util-gfm": "^2.0.1",
|
|
37
|
+
"mdast-util-gfm-table": "^1.0.6",
|
|
38
|
+
"mdast-util-mdx": "2.0.0",
|
|
30
39
|
"mdast-util-mdx-jsx": "^2.0.1",
|
|
31
40
|
"mdast-util-to-markdown": "^1.3.0",
|
|
41
|
+
"mdast-util-toc": "^6.1.0",
|
|
42
|
+
"micromark": "^3.1.0",
|
|
43
|
+
"micromark-core-commonmark": "^1.0.6",
|
|
44
|
+
"micromark-extension-directive": "^2.1.2",
|
|
45
|
+
"micromark-extension-frontmatter": "^1.0.0",
|
|
46
|
+
"micromark-extension-gfm": "^2.0.1",
|
|
47
|
+
"micromark-extension-mdx": "1.0.0",
|
|
48
|
+
"micromark-extension-mdx-jsx": "1.0.3",
|
|
49
|
+
"micromark-extension-mdxjs": "1.0.0",
|
|
50
|
+
"micromark-factory-space": "^1.0.0",
|
|
51
|
+
"micromark-factory-whitespace": "^1.0.0",
|
|
52
|
+
"micromark-util-character": "^1.1.0",
|
|
53
|
+
"micromark-util-chunked": "^1.0.0",
|
|
54
|
+
"micromark-util-classify-character": "^1.0.0",
|
|
55
|
+
"micromark-util-normalize-identifier": "^1.0.0",
|
|
56
|
+
"micromark-util-resolve-all": "^1.0.0",
|
|
57
|
+
"micromark-util-symbol": "^1.0.1",
|
|
58
|
+
"micromark-util-types": "^1.0.2",
|
|
59
|
+
"parse-entities": "^4.0.0",
|
|
32
60
|
"prettier": "^2.7.1",
|
|
33
61
|
"remark": "^14.0.2",
|
|
34
62
|
"remark-mdx": "^2.1.2",
|
|
63
|
+
"stringify-entities": "^4.0.3",
|
|
35
64
|
"typedoc": "^0.23.21",
|
|
36
65
|
"typedoc-plugin-markdown": "^3.13.6",
|
|
66
|
+
"unist-util-source": "^4.0.2",
|
|
37
67
|
"unist-util-visit": "^4.1.0",
|
|
68
|
+
"unist-util-visit-parents": "^5.1.3",
|
|
69
|
+
"uvu": "^0.5.6",
|
|
38
70
|
"vfile": "^4.2.0"
|
|
39
71
|
},
|
|
40
72
|
"publishConfig": {
|
|
@@ -47,6 +79,8 @@
|
|
|
47
79
|
"devDependencies": {
|
|
48
80
|
"@swc/core": "^1.2.210",
|
|
49
81
|
"@swc/jest": "^0.2.21",
|
|
82
|
+
"@tailwindcss/forms": "^0.5.3",
|
|
83
|
+
"@tailwindcss/typography": "^0.5.9",
|
|
50
84
|
"@tinacms/scripts": "1.0.2",
|
|
51
85
|
"@types/cors": "^2.8.7",
|
|
52
86
|
"@types/estree": "^0.0.50",
|
|
@@ -60,8 +94,10 @@
|
|
|
60
94
|
"@types/node": "^14.18.21",
|
|
61
95
|
"@types/normalize-path": "^3.0.0",
|
|
62
96
|
"@types/prettier": "^2.6.3",
|
|
97
|
+
"@types/react": "^18.0.27",
|
|
63
98
|
"@types/ws": "^7.2.6",
|
|
64
99
|
"@types/yup": "^0.29.7",
|
|
100
|
+
"@vitejs/plugin-react": "^2.1.0",
|
|
65
101
|
"c8": "^7.11.3",
|
|
66
102
|
"estree-jsx": "^0.0.1",
|
|
67
103
|
"jest": "^28.1.2",
|
|
@@ -70,6 +106,11 @@
|
|
|
70
106
|
"jest-matcher-utils": "^28.1.1",
|
|
71
107
|
"mdast": "^3.0.0",
|
|
72
108
|
"nodemon": "2.0.19",
|
|
109
|
+
"postcss": "^8.4.21",
|
|
110
|
+
"react": "^18.2.0",
|
|
111
|
+
"react-dom": "^18.2.0",
|
|
112
|
+
"react-monaco-editor": "^0.51.0",
|
|
113
|
+
"tailwindcss": "^3.2.4",
|
|
73
114
|
"ts-node": "^10.8.2",
|
|
74
115
|
"typescript": "^4.7.4",
|
|
75
116
|
"vite": "^3.0.2",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
File without changes
|