@tinacms/mdx 0.0.0-c72bb45-20241118014035 → 0.0.0-cef656e-20250119001929
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 +3952 -3470
- package/dist/index.js +4032 -3549
- package/dist/index.mjs +3949 -3469
- 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 +1 -0
- 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 +3 -3
- package/package.json +12 -7
|
@@ -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
|
@@ -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;
|
|
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
35
|
export type Marks = 'strong' | 'emphasis' | 'inlineCode';
|
|
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-cef656e-20250119001929",
|
|
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",
|
|
@@ -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": "
|
|
59
|
+
"@tinacms/schema-tools": "1.7.0"
|
|
60
60
|
},
|
|
61
61
|
"publishConfig": {
|
|
62
62
|
"registry": "https://registry.npmjs.org"
|
|
@@ -67,6 +67,7 @@
|
|
|
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
73
|
"@types/node": "^22.9.0",
|
|
@@ -75,20 +76,24 @@
|
|
|
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
84
|
"typescript": "^5.6.3",
|
|
81
85
|
"vite": "^4.5.5",
|
|
82
86
|
"vitest": "^0.32.4",
|
|
83
|
-
"
|
|
87
|
+
"zod": "^3.23.8",
|
|
88
|
+
"@tinacms/scripts": "1.3.1"
|
|
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
|
}
|