@tinacms/mdx 0.0.0-877699d-20250102032632 → 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 +126 -58
- package/dist/index.js +129 -61
- package/dist/index.mjs +126 -58
- 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 +2 -0
- package/dist/parse/remarkToPlate.d.ts +1 -1
- package/dist/stringify/acorn.d.ts +3 -3
- package/dist/stringify/index.d.ts +4 -4
- package/package.json +11 -6
package/dist/index.browser.mjs
CHANGED
|
@@ -38154,10 +38154,22 @@ var Xh = Q({ "src/language-js/parse/acorn-and-espree.js"(a, u) {
|
|
|
38154
38154
|
var mc = Xh();
|
|
38155
38155
|
|
|
38156
38156
|
// src/stringify/acorn.ts
|
|
38157
|
-
|
|
38158
|
-
|
|
38157
|
+
function generateRandom6LetterString() {
|
|
38158
|
+
const characters = "abcdefghijklmnopqrstuvwxyz";
|
|
38159
|
+
let result = "";
|
|
38160
|
+
for (let i = 0; i < 6; i++) {
|
|
38161
|
+
const randomIndex = Math.floor(Math.random() * characters.length);
|
|
38162
|
+
result += characters[randomIndex];
|
|
38163
|
+
}
|
|
38164
|
+
return result;
|
|
38165
|
+
}
|
|
38166
|
+
function isMultiline(input) {
|
|
38167
|
+
return input.includes("\n") || input.includes("\r");
|
|
38168
|
+
}
|
|
38169
|
+
var stringifyPropsInline = (element2, field, imageCallback, context) => {
|
|
38170
|
+
return stringifyProps(element2, field, true, imageCallback, context || {});
|
|
38159
38171
|
};
|
|
38160
|
-
function stringifyProps(element2, parentField, flatten2, imageCallback) {
|
|
38172
|
+
function stringifyProps(element2, parentField, flatten2, imageCallback, context) {
|
|
38161
38173
|
const attributes2 = [];
|
|
38162
38174
|
const children = [];
|
|
38163
38175
|
let template;
|
|
@@ -38181,6 +38193,16 @@ function stringifyProps(element2, parentField, flatten2, imageCallback) {
|
|
|
38181
38193
|
if (template.fields.find((f) => f.name === "children")) {
|
|
38182
38194
|
directiveType = "block";
|
|
38183
38195
|
}
|
|
38196
|
+
const embedCodes = {};
|
|
38197
|
+
for (const [embedKey, value] of Object.entries(element2.props)) {
|
|
38198
|
+
if (embedKey.startsWith("_tinaEmbeds")) {
|
|
38199
|
+
const key = embedKey.replace("_tinaEmbeds.", "");
|
|
38200
|
+
embedCodes[key] = value;
|
|
38201
|
+
}
|
|
38202
|
+
}
|
|
38203
|
+
for (const key of Object.keys(embedCodes)) {
|
|
38204
|
+
delete element2.props[`_tinaEmbeds.${key}`];
|
|
38205
|
+
}
|
|
38184
38206
|
useDirective = !!template.match;
|
|
38185
38207
|
Object.entries(element2.props).forEach(([name2, value]) => {
|
|
38186
38208
|
if (typeof template === "string") {
|
|
@@ -38231,11 +38253,22 @@ function stringifyProps(element2, parentField, flatten2, imageCallback) {
|
|
|
38231
38253
|
}
|
|
38232
38254
|
} else {
|
|
38233
38255
|
if (typeof value === "string") {
|
|
38234
|
-
|
|
38235
|
-
|
|
38236
|
-
|
|
38237
|
-
value
|
|
38238
|
-
|
|
38256
|
+
if (isMultiline(value)) {
|
|
38257
|
+
const code3 = embedCodes[name2] || generateRandom6LetterString();
|
|
38258
|
+
context._tinaEmbeds = context._tinaEmbeds || {};
|
|
38259
|
+
context._tinaEmbeds[code3] = value;
|
|
38260
|
+
attributes2.push({
|
|
38261
|
+
type: "mdxJsxAttribute",
|
|
38262
|
+
name: name2,
|
|
38263
|
+
value: `_tinaEmbeds.${code3}`
|
|
38264
|
+
});
|
|
38265
|
+
} else {
|
|
38266
|
+
attributes2.push({
|
|
38267
|
+
type: "mdxJsxAttribute",
|
|
38268
|
+
name: name2,
|
|
38269
|
+
value
|
|
38270
|
+
});
|
|
38271
|
+
}
|
|
38239
38272
|
} else {
|
|
38240
38273
|
throw new Error(
|
|
38241
38274
|
`Expected string for attribute on field ${field.name}`
|
|
@@ -38321,39 +38354,23 @@ function stringifyProps(element2, parentField, flatten2, imageCallback) {
|
|
|
38321
38354
|
(value2) => value2.type === "root" && Array.isArray(value2.children),
|
|
38322
38355
|
`Nested rich-text element is not a valid shape for field ${field.name}`
|
|
38323
38356
|
);
|
|
38357
|
+
const code3 = value.embedCode || generateRandom6LetterString();
|
|
38324
38358
|
if (field.name === "children") {
|
|
38325
|
-
const root2 = rootElement(value, field, imageCallback);
|
|
38359
|
+
const root2 = rootElement(value, field, imageCallback, context);
|
|
38326
38360
|
root2.children.forEach((child) => {
|
|
38327
38361
|
children.push(child);
|
|
38328
38362
|
});
|
|
38329
38363
|
return;
|
|
38330
38364
|
} else {
|
|
38331
38365
|
const stringValue = stringifyMDX(value, field, imageCallback);
|
|
38332
|
-
|
|
38333
|
-
|
|
38334
|
-
}
|
|
38335
|
-
}
|
|
38336
|
-
if (flatten2) {
|
|
38337
|
-
attributes2.push({
|
|
38338
|
-
type: "mdxJsxAttribute",
|
|
38339
|
-
name: name2,
|
|
38340
|
-
value: {
|
|
38341
|
-
type: "mdxJsxAttributeValueExpression",
|
|
38342
|
-
value: `<>${val.trim()}</>`
|
|
38343
|
-
}
|
|
38344
|
-
});
|
|
38345
|
-
} else {
|
|
38346
|
-
attributes2.push({
|
|
38347
|
-
type: "mdxJsxAttribute",
|
|
38348
|
-
name: name2,
|
|
38349
|
-
value: {
|
|
38350
|
-
type: "mdxJsxAttributeValueExpression",
|
|
38351
|
-
value: `<>
|
|
38352
|
-
${val}
|
|
38353
|
-
</>`
|
|
38354
|
-
}
|
|
38355
|
-
});
|
|
38366
|
+
context._tinaEmbeds = context._tinaEmbeds || {};
|
|
38367
|
+
context._tinaEmbeds[code3] = stringValue;
|
|
38356
38368
|
}
|
|
38369
|
+
attributes2.push({
|
|
38370
|
+
type: "mdxJsxAttribute",
|
|
38371
|
+
name: name2,
|
|
38372
|
+
value: `_tinaEmbeds.${code3}`
|
|
38373
|
+
});
|
|
38357
38374
|
}
|
|
38358
38375
|
break;
|
|
38359
38376
|
default:
|
|
@@ -38618,7 +38635,7 @@ var eat2 = (c, field, imageCallback) => {
|
|
|
38618
38635
|
}
|
|
38619
38636
|
if (markToProcess === "inlineCode") {
|
|
38620
38637
|
if (nonMatchingSiblingIndex) {
|
|
38621
|
-
throw new Error(
|
|
38638
|
+
throw new Error("Marks inside inline code are not supported");
|
|
38622
38639
|
}
|
|
38623
38640
|
const node2 = {
|
|
38624
38641
|
type: markToProcess,
|
|
@@ -38653,7 +38670,8 @@ var cleanNode = (node2, mark) => {
|
|
|
38653
38670
|
const markToClear = {
|
|
38654
38671
|
strong: "bold",
|
|
38655
38672
|
emphasis: "italic",
|
|
38656
|
-
inlineCode: "code"
|
|
38673
|
+
inlineCode: "code",
|
|
38674
|
+
delete: "strikethrough"
|
|
38657
38675
|
}[mark];
|
|
38658
38676
|
Object.entries(node2).map(([key, value]) => {
|
|
38659
38677
|
if (key !== markToClear) {
|
|
@@ -38790,7 +38808,7 @@ ${match.start} /${match.name || template.name} ${match.end}`;
|
|
|
38790
38808
|
}
|
|
38791
38809
|
|
|
38792
38810
|
// src/stringify/index.ts
|
|
38793
|
-
var stringifyMDX = (value, field, imageCallback) => {
|
|
38811
|
+
var stringifyMDX = (value, field, imageCallback, context = {}) => {
|
|
38794
38812
|
if (field.parser?.type === "markdown") {
|
|
38795
38813
|
return stringifyMDX2(value, field, imageCallback);
|
|
38796
38814
|
}
|
|
@@ -38805,7 +38823,7 @@ var stringifyMDX = (value, field, imageCallback) => {
|
|
|
38805
38823
|
return value.children[0].value;
|
|
38806
38824
|
}
|
|
38807
38825
|
}
|
|
38808
|
-
const tree = rootElement(value, field, imageCallback);
|
|
38826
|
+
const tree = rootElement(value, field, imageCallback, context);
|
|
38809
38827
|
const res = toTinaMarkdown2(tree, field);
|
|
38810
38828
|
const templatesWithMatchers = field.templates?.filter(
|
|
38811
38829
|
(template) => template.match
|
|
@@ -38866,10 +38884,10 @@ var toTinaMarkdown2 = (tree, field) => {
|
|
|
38866
38884
|
handlers
|
|
38867
38885
|
});
|
|
38868
38886
|
};
|
|
38869
|
-
var rootElement = (content3, field, imageCallback) => {
|
|
38887
|
+
var rootElement = (content3, field, imageCallback, context) => {
|
|
38870
38888
|
const children = [];
|
|
38871
38889
|
content3.children?.forEach((child) => {
|
|
38872
|
-
const value = blockElement(child, field, imageCallback);
|
|
38890
|
+
const value = blockElement(child, field, imageCallback, context);
|
|
38873
38891
|
if (value) {
|
|
38874
38892
|
children.push(value);
|
|
38875
38893
|
}
|
|
@@ -38879,7 +38897,7 @@ var rootElement = (content3, field, imageCallback) => {
|
|
|
38879
38897
|
children
|
|
38880
38898
|
};
|
|
38881
38899
|
};
|
|
38882
|
-
var blockElement = (content3, field, imageCallback) => {
|
|
38900
|
+
var blockElement = (content3, field, imageCallback, context) => {
|
|
38883
38901
|
switch (content3.type) {
|
|
38884
38902
|
case "h1":
|
|
38885
38903
|
case "h2":
|
|
@@ -38941,7 +38959,7 @@ var blockElement = (content3, field, imageCallback) => {
|
|
|
38941
38959
|
})
|
|
38942
38960
|
};
|
|
38943
38961
|
}
|
|
38944
|
-
const { children, attributes: attributes2, useDirective, directiveType } = stringifyProps(content3, field, false, imageCallback);
|
|
38962
|
+
const { children, attributes: attributes2, useDirective, directiveType } = stringifyProps(content3, field, false, imageCallback, context);
|
|
38945
38963
|
if (useDirective) {
|
|
38946
38964
|
const name2 = content3.name;
|
|
38947
38965
|
if (!name2) {
|
|
@@ -39111,6 +39129,9 @@ var getMarks = (content3) => {
|
|
|
39111
39129
|
if (content3.code) {
|
|
39112
39130
|
marks.push("inlineCode");
|
|
39113
39131
|
}
|
|
39132
|
+
if (content3.strikethrough) {
|
|
39133
|
+
marks.push("delete");
|
|
39134
|
+
}
|
|
39114
39135
|
return marks;
|
|
39115
39136
|
};
|
|
39116
39137
|
|
|
@@ -39555,7 +39576,8 @@ var cleanNode2 = (node2, mark) => {
|
|
|
39555
39576
|
const markToClear = {
|
|
39556
39577
|
strong: "bold",
|
|
39557
39578
|
emphasis: "italic",
|
|
39558
|
-
inlineCode: "code"
|
|
39579
|
+
inlineCode: "code",
|
|
39580
|
+
delete: "strikethrough"
|
|
39559
39581
|
}[mark];
|
|
39560
39582
|
Object.entries(node2).map(([key, value]) => {
|
|
39561
39583
|
if (key !== markToClear) {
|
|
@@ -42108,7 +42130,7 @@ function compact(tree) {
|
|
|
42108
42130
|
var import_lodash = __toESM(require_lodash());
|
|
42109
42131
|
|
|
42110
42132
|
// src/parse/acorn.ts
|
|
42111
|
-
var extractAttributes = (attributes2, fields, imageCallback) => {
|
|
42133
|
+
var extractAttributes = (attributes2, fields, imageCallback, context) => {
|
|
42112
42134
|
const properties = {};
|
|
42113
42135
|
attributes2?.forEach((attribute) => {
|
|
42114
42136
|
assertType(attribute, "mdxJsxAttribute");
|
|
@@ -42122,7 +42144,9 @@ var extractAttributes = (attributes2, fields, imageCallback) => {
|
|
|
42122
42144
|
properties[attribute.name] = extractAttribute(
|
|
42123
42145
|
attribute,
|
|
42124
42146
|
field,
|
|
42125
|
-
imageCallback
|
|
42147
|
+
imageCallback,
|
|
42148
|
+
context,
|
|
42149
|
+
(name2, value) => properties[name2] = value
|
|
42126
42150
|
);
|
|
42127
42151
|
} catch (e) {
|
|
42128
42152
|
if (e instanceof Error) {
|
|
@@ -42135,7 +42159,7 @@ var extractAttributes = (attributes2, fields, imageCallback) => {
|
|
|
42135
42159
|
});
|
|
42136
42160
|
return properties;
|
|
42137
42161
|
};
|
|
42138
|
-
var extractAttribute = (attribute, field, imageCallback) => {
|
|
42162
|
+
var extractAttribute = (attribute, field, imageCallback, context, addProperty) => {
|
|
42139
42163
|
switch (field.type) {
|
|
42140
42164
|
case "boolean":
|
|
42141
42165
|
case "number":
|
|
@@ -42145,7 +42169,7 @@ var extractAttribute = (attribute, field, imageCallback) => {
|
|
|
42145
42169
|
if (field.list) {
|
|
42146
42170
|
return extractScalar(extractExpression(attribute), field);
|
|
42147
42171
|
} else {
|
|
42148
|
-
return extractString(attribute, field);
|
|
42172
|
+
return extractString(attribute, field, context, addProperty);
|
|
42149
42173
|
}
|
|
42150
42174
|
case "image":
|
|
42151
42175
|
if (field.list) {
|
|
@@ -42155,18 +42179,35 @@ var extractAttribute = (attribute, field, imageCallback) => {
|
|
|
42155
42179
|
);
|
|
42156
42180
|
return values2.split(",").map((value) => imageCallback(value));
|
|
42157
42181
|
} else {
|
|
42158
|
-
const value = extractString(attribute, field);
|
|
42182
|
+
const value = extractString(attribute, field, context, addProperty);
|
|
42159
42183
|
return imageCallback(value);
|
|
42160
42184
|
}
|
|
42161
42185
|
case "reference":
|
|
42162
42186
|
if (field.list) {
|
|
42163
42187
|
return extractScalar(extractExpression(attribute), field);
|
|
42164
42188
|
} else {
|
|
42165
|
-
return extractString(attribute, field);
|
|
42189
|
+
return extractString(attribute, field, context, addProperty);
|
|
42166
42190
|
}
|
|
42167
42191
|
case "object":
|
|
42168
42192
|
return extractObject(extractExpression(attribute), field, imageCallback);
|
|
42169
42193
|
case "rich-text":
|
|
42194
|
+
if (attribute.type === "mdxJsxAttribute") {
|
|
42195
|
+
if (typeof attribute.value === "string") {
|
|
42196
|
+
if (attribute.value.startsWith("_tinaEmbeds")) {
|
|
42197
|
+
const embedValue = context?._tinaEmbeds;
|
|
42198
|
+
const key = attribute.value.split(".")[1];
|
|
42199
|
+
if (typeof key !== "string") {
|
|
42200
|
+
throw new Error(`Unable to extract key from embed value`);
|
|
42201
|
+
}
|
|
42202
|
+
const value = embedValue[key];
|
|
42203
|
+
if (typeof value === "string") {
|
|
42204
|
+
const ast = parseMDX(value, field, imageCallback, context);
|
|
42205
|
+
ast.embedCode = attribute.value.split(".")[1];
|
|
42206
|
+
return ast;
|
|
42207
|
+
}
|
|
42208
|
+
}
|
|
42209
|
+
}
|
|
42210
|
+
}
|
|
42170
42211
|
const JSXString = extractRaw(attribute);
|
|
42171
42212
|
if (JSXString) {
|
|
42172
42213
|
return parseMDX(JSXString, field, imageCallback);
|
|
@@ -42272,9 +42313,21 @@ var extractStatement = (attribute) => {
|
|
|
42272
42313
|
}
|
|
42273
42314
|
throw new Error(`Unable to extract body from expression`);
|
|
42274
42315
|
};
|
|
42275
|
-
var extractString = (attribute, field) => {
|
|
42316
|
+
var extractString = (attribute, field, context, addProperty) => {
|
|
42276
42317
|
if (attribute.type === "mdxJsxAttribute") {
|
|
42277
42318
|
if (typeof attribute.value === "string") {
|
|
42319
|
+
if (attribute.value.startsWith("_tinaEmbeds")) {
|
|
42320
|
+
const embedValue = context?._tinaEmbeds;
|
|
42321
|
+
const key = attribute.value.split(".")[1];
|
|
42322
|
+
if (typeof key !== "string") {
|
|
42323
|
+
throw new Error(`Unable to extract key from embed value`);
|
|
42324
|
+
}
|
|
42325
|
+
const value = embedValue[key];
|
|
42326
|
+
if (typeof value === "string") {
|
|
42327
|
+
addProperty?.(`_tinaEmbeds.${attribute.name}`, key);
|
|
42328
|
+
return value;
|
|
42329
|
+
}
|
|
42330
|
+
}
|
|
42278
42331
|
return attribute.value;
|
|
42279
42332
|
}
|
|
42280
42333
|
}
|
|
@@ -42399,7 +42452,7 @@ function source(value, file) {
|
|
|
42399
42452
|
}
|
|
42400
42453
|
|
|
42401
42454
|
// src/parse/mdx.ts
|
|
42402
|
-
function mdxJsxElement(node2, field, imageCallback) {
|
|
42455
|
+
function mdxJsxElement(node2, field, imageCallback, context) {
|
|
42403
42456
|
try {
|
|
42404
42457
|
const template = field.templates?.find((template2) => {
|
|
42405
42458
|
const templateName = typeof template2 === "string" ? template2 : template2.name;
|
|
@@ -42419,7 +42472,8 @@ function mdxJsxElement(node2, field, imageCallback) {
|
|
|
42419
42472
|
const props = extractAttributes(
|
|
42420
42473
|
node2.attributes,
|
|
42421
42474
|
template.fields,
|
|
42422
|
-
imageCallback
|
|
42475
|
+
imageCallback,
|
|
42476
|
+
context
|
|
42423
42477
|
);
|
|
42424
42478
|
const childField = template.fields.find(
|
|
42425
42479
|
(field2) => field2.name === "children"
|
|
@@ -42487,7 +42541,7 @@ var directiveElement = (node2, field, imageCallback, raw) => {
|
|
|
42487
42541
|
};
|
|
42488
42542
|
|
|
42489
42543
|
// src/parse/remarkToPlate.ts
|
|
42490
|
-
var remarkToSlate = (root2, field, imageCallback, raw, skipMDXProcess) => {
|
|
42544
|
+
var remarkToSlate = (root2, field, imageCallback, raw, skipMDXProcess, context) => {
|
|
42491
42545
|
const mdxJsxElement2 = skipMDXProcess ? (node2) => node2 : mdxJsxElement;
|
|
42492
42546
|
const content3 = (content4) => {
|
|
42493
42547
|
switch (content4.type) {
|
|
@@ -42538,7 +42592,7 @@ var remarkToSlate = (root2, field, imageCallback, raw, skipMDXProcess) => {
|
|
|
42538
42592
|
case "paragraph":
|
|
42539
42593
|
return paragraph2(content4);
|
|
42540
42594
|
case "mdxJsxFlowElement":
|
|
42541
|
-
return mdxJsxElement2(content4, field, imageCallback);
|
|
42595
|
+
return mdxJsxElement2(content4, field, imageCallback, context);
|
|
42542
42596
|
case "thematicBreak":
|
|
42543
42597
|
return {
|
|
42544
42598
|
type: "hr",
|
|
@@ -42634,7 +42688,8 @@ var remarkToSlate = (root2, field, imageCallback, raw, skipMDXProcess) => {
|
|
|
42634
42688
|
mdxJsxElement2(
|
|
42635
42689
|
{ ...child, type: "mdxJsxTextElement" },
|
|
42636
42690
|
field,
|
|
42637
|
-
imageCallback
|
|
42691
|
+
imageCallback,
|
|
42692
|
+
context
|
|
42638
42693
|
)
|
|
42639
42694
|
]
|
|
42640
42695
|
};
|
|
@@ -42747,7 +42802,7 @@ var remarkToSlate = (root2, field, imageCallback, raw, skipMDXProcess) => {
|
|
|
42747
42802
|
const staticPhrasingContent = (content4) => {
|
|
42748
42803
|
switch (content4.type) {
|
|
42749
42804
|
case "mdxJsxTextElement":
|
|
42750
|
-
return mdxJsxElement2(content4, field, imageCallback);
|
|
42805
|
+
return mdxJsxElement2(content4, field, imageCallback, context);
|
|
42751
42806
|
case "text":
|
|
42752
42807
|
return text7(content4);
|
|
42753
42808
|
case "inlineCode":
|
|
@@ -42767,12 +42822,14 @@ var remarkToSlate = (root2, field, imageCallback, raw, skipMDXProcess) => {
|
|
|
42767
42822
|
switch (content4.type) {
|
|
42768
42823
|
case "text":
|
|
42769
42824
|
return text7(content4);
|
|
42825
|
+
case "delete":
|
|
42826
|
+
return phrashingMark(content4);
|
|
42770
42827
|
case "link":
|
|
42771
42828
|
return link2(content4);
|
|
42772
42829
|
case "image":
|
|
42773
42830
|
return image2(content4);
|
|
42774
42831
|
case "mdxJsxTextElement":
|
|
42775
|
-
return mdxJsxElement2(content4, field, imageCallback);
|
|
42832
|
+
return mdxJsxElement2(content4, field, imageCallback, context);
|
|
42776
42833
|
case "emphasis":
|
|
42777
42834
|
return phrashingMark(content4);
|
|
42778
42835
|
case "strong":
|
|
@@ -42831,6 +42888,17 @@ var remarkToSlate = (root2, field, imageCallback, raw, skipMDXProcess) => {
|
|
|
42831
42888
|
});
|
|
42832
42889
|
break;
|
|
42833
42890
|
}
|
|
42891
|
+
case "delete": {
|
|
42892
|
+
const children = (0, import_lodash.default)(
|
|
42893
|
+
node2.children.map(
|
|
42894
|
+
(child) => phrashingMark(child, [...marks, "strikethrough"])
|
|
42895
|
+
)
|
|
42896
|
+
);
|
|
42897
|
+
children.forEach((child) => {
|
|
42898
|
+
accum.push(child);
|
|
42899
|
+
});
|
|
42900
|
+
break;
|
|
42901
|
+
}
|
|
42834
42902
|
case "strong": {
|
|
42835
42903
|
const children = (0, import_lodash.default)(
|
|
42836
42904
|
node2.children.map((child) => phrashingMark(child, [...marks, "bold"]))
|
|
@@ -43034,7 +43102,7 @@ var mdxToAst = (value) => {
|
|
|
43034
43102
|
return remark().use(remarkMdx).use(remarkGfm).parse(value);
|
|
43035
43103
|
};
|
|
43036
43104
|
var 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";
|
|
43037
|
-
var parseMDX = (value, field, imageCallback) => {
|
|
43105
|
+
var parseMDX = (value, field, imageCallback, context) => {
|
|
43038
43106
|
if (!value) {
|
|
43039
43107
|
return { type: "root", children: [] };
|
|
43040
43108
|
}
|
|
@@ -43059,7 +43127,7 @@ var parseMDX = (value, field, imageCallback) => {
|
|
|
43059
43127
|
});
|
|
43060
43128
|
tree = mdxToAst(preprocessedString);
|
|
43061
43129
|
if (tree) {
|
|
43062
|
-
return remarkToSlate(tree, field, imageCallback, value);
|
|
43130
|
+
return remarkToSlate(tree, field, imageCallback, value, false, context);
|
|
43063
43131
|
} else {
|
|
43064
43132
|
return { type: "root", children: [] };
|
|
43065
43133
|
}
|