@tinacms/mdx 1.3.0 → 1.3.2

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.
Files changed (72) hide show
  1. package/dist/index.es.js +2232 -1308
  2. package/dist/index.js +15747 -11148
  3. package/dist/next/index.d.ts +2 -0
  4. package/dist/next/parse/index.d.ts +2 -0
  5. package/dist/next/parse/markdown.d.ts +2 -0
  6. package/dist/next/parse/post-processing.d.ts +3 -0
  7. package/dist/next/shortcodes/index.d.ts +2 -0
  8. package/dist/next/shortcodes/lib/factory-tag.d.ts +4 -0
  9. package/dist/next/shortcodes/lib/jsx-flow.d.ts +3 -0
  10. package/dist/next/shortcodes/lib/jsx-text.d.ts +3 -0
  11. package/dist/next/shortcodes/lib/syntax.d.ts +17 -0
  12. package/dist/next/shortcodes/lib/util.d.ts +3 -0
  13. package/dist/next/shortcodes/mdast/index.d.ts +106 -0
  14. package/dist/next/stringify/acorn.d.ts +21 -0
  15. package/dist/next/stringify/index.d.ts +3 -0
  16. package/dist/next/stringify/marks.d.ts +8 -0
  17. package/dist/next/stringify/pre-processing.d.ts +9 -0
  18. package/dist/next/stringify/to-markdown.d.ts +3 -0
  19. package/dist/next/tests/block-level-1/field.d.ts +2 -0
  20. package/dist/next/tests/block-level-2/field.d.ts +2 -0
  21. package/dist/next/tests/block-level-2/index.test.d.ts +1 -0
  22. package/dist/next/tests/block-level-3/field.d.ts +2 -0
  23. package/dist/next/tests/block-level-3/index.test.d.ts +1 -0
  24. package/dist/next/tests/block-level-nested/field.d.ts +2 -0
  25. package/dist/next/tests/block-level-nested/index.test.d.ts +1 -0
  26. package/dist/next/tests/block-level-unclosed/field.d.ts +2 -0
  27. package/dist/next/tests/block-level-unclosed/index.test.d.ts +1 -0
  28. package/dist/next/tests/expressions-in-text/field.d.ts +2 -0
  29. package/dist/next/tests/expressions-in-text/index.test.d.ts +1 -0
  30. package/dist/next/tests/image-callback/field.d.ts +2 -0
  31. package/dist/next/tests/image-callback/index.test.d.ts +1 -0
  32. package/dist/next/tests/inline/field.d.ts +2 -0
  33. package/dist/next/tests/inline/index.test.d.ts +1 -0
  34. package/dist/next/tests/inline-with-children/field.d.ts +2 -0
  35. package/dist/next/tests/inline-with-children/index.test.d.ts +1 -0
  36. package/dist/next/tests/invalid/field.d.ts +2 -0
  37. package/dist/next/tests/invalid/index.test.d.ts +1 -0
  38. package/dist/next/tests/invalid-2/field.d.ts +2 -0
  39. package/dist/next/tests/invalid-2/index.test.d.ts +1 -0
  40. package/dist/next/tests/invalid-3/field.d.ts +2 -0
  41. package/dist/next/tests/invalid-3/index.test.d.ts +1 -0
  42. package/dist/next/tests/invalid-4/field.d.ts +2 -0
  43. package/dist/next/tests/invalid-4/index.test.d.ts +1 -0
  44. package/dist/next/tests/lists/field.d.ts +2 -0
  45. package/dist/next/tests/lists/index.test.d.ts +1 -0
  46. package/dist/next/tests/markdoc/field.d.ts +2 -0
  47. package/dist/next/tests/markdoc/index.test.d.ts +1 -0
  48. package/dist/next/tests/unrecognized-shortcodes/field.d.ts +2 -0
  49. package/dist/next/tests/unrecognized-shortcodes/index.test.d.ts +1 -0
  50. package/dist/next/tests/util.d.ts +4 -0
  51. package/dist/next/tests/wordpress-style/field.d.ts +2 -0
  52. package/dist/next/tests/wordpress-style/index.test.d.ts +1 -0
  53. package/dist/next/tests/wordpress-style-2/field.d.ts +2 -0
  54. package/dist/next/tests/wordpress-style-2/index.test.d.ts +1 -0
  55. package/dist/next/tests/wordpress-style-2-block-with-children/field.d.ts +2 -0
  56. package/dist/next/tests/wordpress-style-2-block-with-children/index.test.d.ts +1 -0
  57. package/dist/next/tests/wordpress-style-2-with-children/field.d.ts +2 -0
  58. package/dist/next/tests/wordpress-style-2-with-children/index.test.d.ts +1 -0
  59. package/dist/next/util.d.ts +3 -0
  60. package/dist/parse/acorn.d.ts +2 -2
  61. package/dist/parse/index.d.ts +3 -3
  62. package/dist/parse/mdx.d.ts +4 -4
  63. package/dist/parse/parseShortcode.d.ts +2 -4
  64. package/dist/parse/remarkToPlate.d.ts +2 -2
  65. package/dist/stringify/acorn.d.ts +4 -4
  66. package/dist/stringify/index.d.ts +5 -5
  67. package/dist/stringify/marks.d.ts +2 -2
  68. package/dist/stringify/stringifyShortcode.d.ts +2 -4
  69. package/dist/tests/autotest/_config.d.ts +2 -2
  70. package/dist/tests/setup.d.ts +4 -4
  71. package/package.json +53 -47
  72. /package/dist/{tests/temp/shortcodes.test.d.ts → next/tests/block-level-1/index.test.d.ts} +0 -0
@@ -0,0 +1,2 @@
1
+ export { stringifyMDX } from './stringify';
2
+ export { parseMDX } from './parse';
@@ -0,0 +1,2 @@
1
+ import type { RichTextField } from '@tinacms/schema-tools';
2
+ export declare const parseMDX: (value: string, field: RichTextField, imageCallback?: ((s: string) => string) | undefined) => import("../..").RootElement;
@@ -0,0 +1,2 @@
1
+ import type { RichTextField } from '@tinacms/schema-tools';
2
+ export declare const fromMarkdown: (value: string, field: RichTextField) => import("mdast").Root;
@@ -0,0 +1,3 @@
1
+ import { RichTextField } from '@tinacms/schema-tools';
2
+ import type { Root } from 'mdast';
3
+ export declare const postProcessor: (tree: Root, field: RichTextField, imageCallback: (s: string) => string) => import("../..").RootElement;
@@ -0,0 +1,2 @@
1
+ export { mdxJsx } from './lib/syntax';
2
+ export type { Pattern, Options } from './lib/syntax';
@@ -0,0 +1,4 @@
1
+ import type { TokenizeContext, Effects, State } from 'micromark-util-types';
2
+ import type { Acorn, AcornOptions } from 'micromark-factory-mdx-expression';
3
+ import { Pattern } from './syntax';
4
+ export declare function factoryTag(this: TokenizeContext, effects: Effects, ok: State, nok: State, acorn: Acorn | undefined, acornOptions: AcornOptions | undefined, addResult: boolean | undefined, allowLazy: boolean | undefined, tagType: string, tagMarkerType: string, tagClosingMarkerType: string, tagSelfClosingMarker: string, tagNameType: string, tagNamePrimaryType: string, tagNameMemberMarkerType: string, tagNameMemberType: string, tagNamePrefixMarkerType: string, tagNameLocalType: string, tagExpressionAttributeType: string, tagExpressionAttributeMarkerType: string, tagExpressionAttributeValueType: string, tagAttributeType: string, tagAttributeNameType: string, tagAttributeNamePrimaryType: string, tagAttributeNamePrefixMarkerType: string, tagAttributeNameLocalType: string, tagAttributeInitializerMarkerType: string, tagAttributeValueLiteralType: string, tagAttributeValueLiteralMarkerType: string, tagAttributeValueLiteralValueType: string, tagAttributeValueExpressionType: string, tagAttributeValueExpressionMarkerType: string, tagAttributeValueExpressionValueType: string, pattern: Pattern): State;
@@ -0,0 +1,3 @@
1
+ import type { Construct } from 'micromark-util-types';
2
+ import type { Acorn, AcornOptions } from 'micromark-factory-mdx-expression';
3
+ export declare const jsxFlow: (acorn: Acorn | undefined, acornOptions: AcornOptions | undefined, addResult: boolean | undefined, pattern: any) => Construct;
@@ -0,0 +1,3 @@
1
+ import type { Construct } from 'micromark-util-types';
2
+ import type { Acorn, AcornOptions } from 'micromark-factory-mdx-expression';
3
+ export declare const jsxText: (acorn: Acorn | undefined, acornOptions: AcornOptions | undefined, addResult: boolean | undefined, pattern: any) => Construct;
@@ -0,0 +1,17 @@
1
+ import type { Extension } from 'micromark-util-types';
2
+ import type { Acorn, AcornOptions } from 'micromark-factory-mdx-expression';
3
+ export declare type Pattern = {
4
+ start: string;
5
+ end: string;
6
+ name: string;
7
+ templateName: string;
8
+ type: 'inline' | 'flow';
9
+ leaf: boolean;
10
+ };
11
+ export declare type Options = {
12
+ acorn?: Acorn;
13
+ acornOptions?: AcornOptions;
14
+ patterns?: Pattern[];
15
+ addResult?: boolean;
16
+ };
17
+ export declare function mdxJsx(options?: Options): Extension;
@@ -0,0 +1,3 @@
1
+ export declare const findCode: (string: string | undefined | null) => number | null;
2
+ export declare const printCode: (num: number) => void;
3
+ export declare const logSelf: (item: any) => void;
@@ -0,0 +1,106 @@
1
+ import { Pattern } from '../lib/syntax';
2
+ import type { Handle as FromMarkdownHandle } from 'mdast-util-from-markdown';
3
+ import type { Handle as ToMarkdownHandle, Options } from 'mdast-util-to-markdown';
4
+ export declare function mdxJsxFromMarkdown({ patterns }: {
5
+ patterns: Pattern[];
6
+ }): {
7
+ canContainEols: string[];
8
+ enter: {
9
+ mdxJsxFlowTag: FromMarkdownHandle;
10
+ mdxJsxFlowTagClosingMarker: FromMarkdownHandle;
11
+ mdxJsxFlowTagAttribute: FromMarkdownHandle;
12
+ mdxJsxFlowTagExpressionAttribute: FromMarkdownHandle;
13
+ mdxJsxFlowTagAttributeValueLiteral: FromMarkdownHandle;
14
+ mdxJsxFlowTagAttributeValueExpression: FromMarkdownHandle;
15
+ mdxJsxFlowTagSelfClosingMarker: FromMarkdownHandle;
16
+ mdxJsxTextTag: FromMarkdownHandle;
17
+ mdxJsxTextTagClosingMarker: FromMarkdownHandle;
18
+ mdxJsxTextTagAttribute: FromMarkdownHandle;
19
+ mdxJsxTextTagExpressionAttribute: FromMarkdownHandle;
20
+ mdxJsxTextTagAttributeValueLiteral: FromMarkdownHandle;
21
+ mdxJsxTextTagAttributeValueExpression: FromMarkdownHandle;
22
+ mdxJsxTextTagSelfClosingMarker: FromMarkdownHandle;
23
+ };
24
+ exit: {
25
+ mdxJsxFlowTagClosingMarker: FromMarkdownHandle;
26
+ mdxJsxFlowTagNamePrimary: FromMarkdownHandle;
27
+ mdxJsxFlowTagNameMember: FromMarkdownHandle;
28
+ mdxJsxFlowTagNameLocal: FromMarkdownHandle;
29
+ mdxJsxFlowTagExpressionAttribute: FromMarkdownHandle;
30
+ mdxJsxFlowTagExpressionAttributeValue: FromMarkdownHandle;
31
+ mdxJsxFlowTagAttributeNamePrimary: FromMarkdownHandle;
32
+ mdxJsxFlowTagAttributeNameLocal: FromMarkdownHandle;
33
+ mdxJsxFlowTagAttributeValueLiteral: FromMarkdownHandle;
34
+ mdxJsxFlowTagAttributeValueLiteralValue: FromMarkdownHandle;
35
+ mdxJsxFlowTagAttributeValueExpression: FromMarkdownHandle;
36
+ mdxJsxFlowTagAttributeValueExpressionValue: FromMarkdownHandle;
37
+ mdxJsxFlowTagSelfClosingMarker: FromMarkdownHandle;
38
+ mdxJsxFlowTag: FromMarkdownHandle;
39
+ mdxJsxTextTagClosingMarker: FromMarkdownHandle;
40
+ mdxJsxTextTagNamePrimary: FromMarkdownHandle;
41
+ mdxJsxTextTagNameMember: FromMarkdownHandle;
42
+ mdxJsxTextTagNameLocal: FromMarkdownHandle;
43
+ mdxJsxTextTagExpressionAttribute: FromMarkdownHandle;
44
+ mdxJsxTextTagExpressionAttributeValue: FromMarkdownHandle;
45
+ mdxJsxTextTagAttributeNamePrimary: FromMarkdownHandle;
46
+ mdxJsxTextTagAttributeNameLocal: FromMarkdownHandle;
47
+ mdxJsxTextTagAttributeValueLiteral: FromMarkdownHandle;
48
+ mdxJsxTextTagAttributeValueLiteralValue: FromMarkdownHandle;
49
+ mdxJsxTextTagAttributeValueExpression: FromMarkdownHandle;
50
+ mdxJsxTextTagAttributeValueExpressionValue: FromMarkdownHandle;
51
+ mdxJsxTextTagSelfClosingMarker: FromMarkdownHandle;
52
+ mdxJsxTextTag: FromMarkdownHandle;
53
+ };
54
+ };
55
+ /**
56
+ * Create an extension for `mdast-util-to-markdown` to enable MDX JSX.
57
+ *
58
+ * This extension configures `mdast-util-to-markdown` with
59
+ * `options.fences: true` and `options.resourceLink: true` too, do not
60
+ * overwrite them!
61
+ *
62
+ */
63
+ export declare const mdxJsxToMarkdown: (options: Options & {
64
+ printWidth?: number;
65
+ quoteSmart?: boolean;
66
+ tightSelfClosing?: boolean;
67
+ patterns: Pattern[];
68
+ }) => {
69
+ handlers: {
70
+ mdxJsxFlowElement: ToMarkdownHandle;
71
+ mdxJsxTextElement: ToMarkdownHandle;
72
+ };
73
+ unsafe: ({
74
+ character: string;
75
+ inConstruct: "phrasing"[];
76
+ atBreak?: undefined;
77
+ } | {
78
+ atBreak: boolean;
79
+ character: string;
80
+ inConstruct?: undefined;
81
+ })[];
82
+ fences: boolean;
83
+ resourceLink: boolean;
84
+ bullet?: "-" | "*" | "+" | null | undefined;
85
+ bulletOther?: "-" | "*" | "+" | null | undefined;
86
+ bulletOrdered?: ")" | "." | null | undefined;
87
+ bulletOrderedOther?: ")" | "." | null | undefined;
88
+ closeAtx?: boolean | null | undefined;
89
+ emphasis?: "*" | "_" | null | undefined;
90
+ fence?: "`" | "~" | null | undefined;
91
+ incrementListMarker?: boolean | null | undefined;
92
+ listItemIndent?: "tab" | "one" | "mixed" | null | undefined;
93
+ quote?: "\"" | "'" | null | undefined;
94
+ rule?: "-" | "*" | "_" | null | undefined;
95
+ ruleRepetition?: number | null | undefined;
96
+ ruleSpaces?: boolean | null | undefined;
97
+ setext?: boolean | null | undefined;
98
+ strong?: "*" | "_" | null | undefined;
99
+ tightDefinitions?: boolean | null | undefined;
100
+ join?: import("mdast-util-to-markdown").Join[] | null | undefined;
101
+ extensions?: Options[] | null | undefined;
102
+ printWidth?: number | undefined;
103
+ quoteSmart?: boolean | undefined;
104
+ tightSelfClosing?: boolean | undefined;
105
+ patterns: Pattern[];
106
+ };
@@ -0,0 +1,21 @@
1
+ import type { RichTextField } from '@tinacms/schema-tools';
2
+ import type { MdxJsxAttribute } from 'mdast-util-mdx-jsx';
3
+ 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) => {
6
+ attributes: MdxJsxAttribute[];
7
+ children: Md.PhrasingContent[];
8
+ };
9
+ export declare function stringifyProps(element: Plate.MdxInlineElement, parentField: RichTextField, flatten: boolean, imageCallback: (url: string) => string): {
10
+ attributes: MdxJsxAttribute[];
11
+ children: Md.PhrasingContent[];
12
+ useDirective: boolean;
13
+ directiveType: string;
14
+ };
15
+ export declare function stringifyProps(element: Plate.MdxBlockElement, parentField: RichTextField, flatten: boolean, imageCallback: (url: string) => string): {
16
+ attributes: MdxJsxAttribute[];
17
+ children: Md.BlockContent[];
18
+ useDirective: boolean;
19
+ directiveType: string;
20
+ };
21
+ export declare function assertShape<T extends unknown>(value: unknown, callback: (item: any) => boolean, errorMessage?: string): asserts value is T;
@@ -0,0 +1,3 @@
1
+ import { RichTextField } from '@tinacms/schema-tools';
2
+ import type * as Plate from '../../parse/plate';
3
+ export declare const stringifyMDX: (value: Plate.RootElement, field: RichTextField, imageCallback: (url: string) => string) => string | undefined;
@@ -0,0 +1,8 @@
1
+ import type * as Md from 'mdast';
2
+ import type * as Plate from '../../parse/plate';
3
+ import type { RichTextField } from '@tinacms/schema-tools';
4
+ declare type InlineElementWithCallback = Plate.InlineElement & {
5
+ linkifyTextNode?: (arg: Md.Text) => Md.Link;
6
+ };
7
+ export declare const eat: (c: InlineElementWithCallback[], field: RichTextField, imageCallback: (url: string) => string) => Md.PhrasingContent[];
8
+ export {};
@@ -0,0 +1,9 @@
1
+ import type { RichTextField } from '@tinacms/schema-tools';
2
+ import type * as Md from 'mdast';
3
+ import type * as Plate from '../../parse/plate';
4
+ import type { RootElement } from '../../parse/plate';
5
+ export declare const preProcess: (tree: RootElement, field: RichTextField, imageCallback: (url: string) => string) => Md.Root;
6
+ export declare const rootElement: (content: Plate.RootElement, field: RichTextField, imageCallback: (url: string) => string) => Md.Root;
7
+ export declare const blockElement: (content: Plate.BlockElement, field: RichTextField, imageCallback: (url: string) => string) => Md.Content | null;
8
+ export declare type Marks = 'strong' | 'emphasis' | 'inlineCode';
9
+ export declare const getMarks: (content: Plate.InlineElement) => Marks[];
@@ -0,0 +1,3 @@
1
+ import type { RichTextField } from '@tinacms/schema-tools';
2
+ import type * as Md from 'mdast';
3
+ export declare const toTinaMarkdown: (tree: Md.Root, field: RichTextField) => string;
@@ -0,0 +1,2 @@
1
+ import { RichTextField } from '@tinacms/schema-tools';
2
+ export declare const field: RichTextField;
@@ -0,0 +1,2 @@
1
+ import { RichTextField } from '@tinacms/schema-tools';
2
+ export declare const field: RichTextField;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ import { RichTextField } from '@tinacms/schema-tools';
2
+ export declare const field: RichTextField;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ import { RichTextField } from '@tinacms/schema-tools';
2
+ export declare const field: RichTextField;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ import { RichTextField } from '@tinacms/schema-tools';
2
+ export declare const field: RichTextField;
@@ -0,0 +1,2 @@
1
+ import { RichTextField } from '@tinacms/schema-tools';
2
+ export declare const field: RichTextField;
@@ -0,0 +1,2 @@
1
+ import { RichTextField } from '@tinacms/schema-tools';
2
+ export declare const field: RichTextField;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ import { RichTextField } from '@tinacms/schema-tools';
2
+ export declare const field: RichTextField;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ import { RichTextField } from '@tinacms/schema-tools';
2
+ export declare const field: RichTextField;
@@ -0,0 +1,2 @@
1
+ import { RichTextField } from '@tinacms/schema-tools';
2
+ export declare const field: RichTextField;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ import { RichTextField } from '@tinacms/schema-tools';
2
+ export declare const field: RichTextField;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ import { RichTextField } from '@tinacms/schema-tools';
2
+ export declare const field: RichTextField;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ import { RichTextField } from '@tinacms/schema-tools';
2
+ export declare const field: RichTextField;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ import { RichTextField } from '@tinacms/schema-tools';
2
+ export declare const field: RichTextField;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ import { RichTextField } from '@tinacms/schema-tools';
2
+ export declare const field: RichTextField;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ import { RichTextField } from '@tinacms/schema-tools';
2
+ export declare const field: RichTextField;
@@ -0,0 +1,4 @@
1
+ export declare function removePosition(tree: any): any;
2
+ export declare const print: (tree: object) => string;
3
+ export declare const nodePath: (dir: string) => string;
4
+ export declare const mdPath: (dir: string) => string;
@@ -0,0 +1,2 @@
1
+ import { RichTextField } from '@tinacms/schema-tools';
2
+ export declare const field: RichTextField;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ import { RichTextField } from '@tinacms/schema-tools';
2
+ export declare const field: RichTextField;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ import { RichTextField } from '@tinacms/schema-tools';
2
+ export declare const field: RichTextField;
@@ -0,0 +1,2 @@
1
+ import { RichTextField } from '@tinacms/schema-tools';
2
+ export declare const field: RichTextField;
@@ -0,0 +1,3 @@
1
+ import type { RichTextField } from '@tinacms/schema-tools';
2
+ import type { Pattern } from './shortcodes';
3
+ export declare const getFieldPatterns: (field: RichTextField) => Pattern[];
@@ -4,6 +4,6 @@
4
4
 
5
5
  */
6
6
  import type { MdxJsxAttribute, MdxJsxExpressionAttribute } from 'mdast-util-mdx-jsx';
7
- import type { TinaFieldBase } from '@tinacms/schema-tools';
8
- export declare const extractAttributes: (attributes: (MdxJsxAttribute | MdxJsxExpressionAttribute)[], fields: TinaFieldBase[], imageCallback: (image: string) => string) => Record<string, unknown>;
7
+ import type { TinaField } from '@tinacms/schema-tools';
8
+ export declare const extractAttributes: (attributes: (MdxJsxAttribute | MdxJsxExpressionAttribute)[], fields: TinaField[], imageCallback: (image: string) => string) => Record<string, unknown>;
9
9
  export declare const trimFragments: (string: string) => string;
@@ -4,7 +4,7 @@
4
4
 
5
5
  */
6
6
  import { RichTextParseError } from './remarkToPlate';
7
- import type { RichTypeInner } from '@tinacms/schema-tools';
7
+ import type { RichTextType } from '@tinacms/schema-tools';
8
8
  import type * as Plate from './plate';
9
9
  /**
10
10
  * ### Convert the MDXAST into an API-friendly format
@@ -55,10 +55,10 @@ import type * as Plate from './plate';
55
55
  * 2. We don't need to do any client-side parsing. Since TinaMarkdown and the slate editor work with the same
56
56
  * format we can just allow Tina to do it's thing and update the form value with no additional work.
57
57
  */
58
- export declare const markdownToAst: (value: string, field: RichTypeInner) => import("mdast").Root;
58
+ export declare const markdownToAst: (value: string, field: RichTextType) => import("mdast").Root;
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: RichTypeInner, imageCallback: (s: string) => string) => Plate.RootElement;
62
+ export declare const parseMDX: (value: string, field: RichTextType, imageCallback: (s: string) => string) => Plate.RootElement;
63
63
  export declare const invalidMarkdown: (e: RichTextParseError, value: string) => Plate.RootElement;
64
64
  export declare const replaceAll: (string: string, target: string, value: string) => string;
@@ -4,10 +4,10 @@
4
4
 
5
5
  */
6
6
  import type { MdxJsxTextElement, MdxJsxFlowElement } from 'mdast-util-mdx-jsx';
7
- import type { RichTypeInner } from '@tinacms/schema-tools';
7
+ 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: RichTypeInner, imageCallback: (url: string) => string): Plate.MdxInlineElement;
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;
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
+ export declare const directiveElement: (node: ContainerDirective | LeafDirective, field: RichTextType, imageCallback: (url: string) => string, raw?: string | undefined) => Plate.BlockElement | Plate.ParagraphElement;
@@ -3,7 +3,5 @@
3
3
 
4
4
 
5
5
  */
6
- import { Template } from '@tinacms/schema-tools';
7
- export declare function parseShortcode(preprocessedString: string, template: Template<false> & {
8
- inline?: boolean;
9
- }): string;
6
+ import { RichTextTemplate } from '@tinacms/schema-tools';
7
+ export declare function parseShortcode(preprocessedString: string, template: RichTextTemplate): string;
@@ -5,7 +5,7 @@
5
5
  */
6
6
  import type * as Md from 'mdast';
7
7
  import type * as Plate from './plate';
8
- import type { RichTypeInner } from '@tinacms/schema-tools';
8
+ import type { RichTextType } from '@tinacms/schema-tools';
9
9
  import type { MdxJsxTextElement, MdxJsxFlowElement } from 'mdast-util-mdx-jsx';
10
10
  import { ContainerDirective } from 'mdast-util-directive';
11
11
  export type { Position, PositionItem } from './plate';
@@ -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: RichTypeInner, imageCallback: (url: string) => string, raw?: string | undefined) => Plate.RootElement;
26
+ export declare const remarkToSlate: (root: Md.Root | MdxJsxFlowElement | MdxJsxTextElement | ContainerDirective, field: RichTextType, imageCallback: (url: string) => string, raw?: string | undefined, skipMDXProcess?: boolean | undefined) => 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
- import type { RichTypeInner } from '@tinacms/schema-tools';
1
+ import type { RichTextType } 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: RichTypeInner, imageCallback: (url: string) => string) => {
5
+ export declare const stringifyPropsInline: (element: Plate.MdxInlineElement, field: RichTextType, imageCallback: (url: string) => string) => {
6
6
  attributes: MdxJsxAttribute[];
7
7
  children: Md.PhrasingContent[];
8
8
  };
9
- export declare function stringifyProps(element: Plate.MdxInlineElement, parentField: RichTypeInner, flatten: boolean, imageCallback: (url: string) => string): {
9
+ export declare function stringifyProps(element: Plate.MdxInlineElement, parentField: RichTextType, 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: RichTypeInner, flatten: boolean, imageCallback: (url: string) => string): {
15
+ export declare function stringifyProps(element: Plate.MdxBlockElement, parentField: RichTextType, flatten: boolean, imageCallback: (url: string) => string): {
16
16
  attributes: MdxJsxAttribute[];
17
17
  children: Md.BlockContent[];
18
18
  useDirective: boolean;
@@ -4,7 +4,7 @@
4
4
 
5
5
  */
6
6
  import { MdxJsxTextElement, MdxJsxFlowElement } from 'mdast-util-mdx-jsx';
7
- import type { RichTypeInner } from '@tinacms/schema-tools';
7
+ import type { RichTextType } from '@tinacms/schema-tools';
8
8
  import type * as Md from 'mdast';
9
9
  import type * as Plate from '../parse/plate';
10
10
  declare module 'mdast' {
@@ -21,7 +21,7 @@ declare module 'mdast' {
21
21
  mdxJsxFlowElement: MdxJsxFlowElement;
22
22
  }
23
23
  }
24
- export declare const stringifyMDX: (value: Plate.RootElement, field: RichTypeInner, imageCallback: (url: string) => string) => string | undefined;
24
+ export declare const stringifyMDX: (value: Plate.RootElement, field: RichTextType, imageCallback: (url: string) => string) => string | undefined;
25
25
  export declare type Pattern = {
26
26
  start: string;
27
27
  end: string;
@@ -29,8 +29,8 @@ export declare type Pattern = {
29
29
  templateName: string;
30
30
  type: 'block' | 'leaf';
31
31
  };
32
- export declare const toTinaMarkdown: (tree: Md.Root, field: RichTypeInner) => string;
33
- export declare const rootElement: (content: Plate.RootElement, field: RichTypeInner, imageCallback: (url: string) => string) => Md.Root;
34
- export declare const blockElement: (content: Plate.BlockElement, field: RichTypeInner, imageCallback: (url: string) => string) => Md.Content | null;
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
35
  export declare type Marks = 'strong' | 'emphasis' | 'inlineCode';
36
36
  export declare const getMarks: (content: Plate.InlineElement) => Marks[];
@@ -5,9 +5,9 @@
5
5
  */
6
6
  import type * as Md from 'mdast';
7
7
  import type * as Plate from '../parse/plate';
8
- import type { RichTypeInner } from '@tinacms/schema-tools';
8
+ import type { RichTextType } from '@tinacms/schema-tools';
9
9
  declare type InlineElementWithCallback = Plate.InlineElement & {
10
10
  linkifyTextNode?: (arg: Md.Text) => Md.Link;
11
11
  };
12
- export declare const eat: (c: InlineElementWithCallback[], field: RichTypeInner, imageCallback: (url: string) => string) => Md.PhrasingContent[];
12
+ export declare const eat: (c: InlineElementWithCallback[], field: RichTextType, imageCallback: (url: string) => string) => Md.PhrasingContent[];
13
13
  export {};
@@ -3,7 +3,5 @@
3
3
 
4
4
 
5
5
  */
6
- import { Template } from '@tinacms/schema-tools';
7
- export declare function stringifyShortcode(preprocessedString: string, template: Template<false> & {
8
- inline?: boolean;
9
- }): string;
6
+ import { RichTextTemplate } from '@tinacms/schema-tools';
7
+ export declare function stringifyShortcode(preprocessedString: string, template: RichTextTemplate): string;
@@ -3,7 +3,7 @@
3
3
 
4
4
 
5
5
  */
6
- import type { RichTypeInner } from '@tinacms/schema-tools';
6
+ import type { RichTextType } from '@tinacms/schema-tools';
7
7
  export { output } from '../setup';
8
8
  export { parseMDX, stringifyMDX } from '../..';
9
- export declare const field: RichTypeInner;
9
+ export declare const field: RichTextType;
@@ -3,17 +3,17 @@
3
3
 
4
4
 
5
5
  */
6
- import type { RichTypeInner } from '@tinacms/schema-tools';
6
+ import type { RichTextType } from '@tinacms/schema-tools';
7
7
  import type { BlockElement, RootElement } from '../parse/plate';
8
- export type { BlockElement, RichTypeInner };
8
+ export type { BlockElement, RichTextType };
9
9
  export declare const output: (object: RootElement) => RootElement;
10
10
  export declare const print: (ast: object, name: string, autoformatted?: boolean | undefined) => string;
11
- export declare const run: (dirname: string, content: any, outputString: any, field: RichTypeInner) => void;
11
+ export declare const run: (dirname: string, content: any, outputString: any, field: RichTextType) => void;
12
12
  declare type GlobFile = Record<string, () => Promise<string>>;
13
13
  export declare const setupNewTests: (markdownContentFiles: GlobFile, testFiles: GlobFile, callback: (newTests: {
14
14
  name: string;
15
15
  markdownContent: () => Promise<string>;
16
16
  }) => void) => void;
17
- export declare const runInner: (name: string, dirname: string, content: string, outputString: Record<string, string>, field: RichTypeInner) => void;
17
+ export declare const runInner: (name: string, dirname: string, content: string, outputString: Record<string, string>, field: RichTextType) => void;
18
18
  export declare const writeTestFile: (dirname: string, name: string, astResult: object, autoformatted?: boolean | undefined) => void;
19
19
  export declare const writeAutoformatFile: (dirname: string, name: string, stringResult: string) => void;