@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.js
CHANGED
|
@@ -5921,12 +5921,12 @@ var require_lodash = __commonJS({
|
|
|
5921
5921
|
});
|
|
5922
5922
|
|
|
5923
5923
|
// src/index.ts
|
|
5924
|
-
var
|
|
5925
|
-
__export(
|
|
5924
|
+
var index_exports = {};
|
|
5925
|
+
__export(index_exports, {
|
|
5926
5926
|
parseMDX: () => parseMDX,
|
|
5927
5927
|
stringifyMDX: () => stringifyMDX
|
|
5928
5928
|
});
|
|
5929
|
-
module.exports = __toCommonJS(
|
|
5929
|
+
module.exports = __toCommonJS(index_exports);
|
|
5930
5930
|
|
|
5931
5931
|
// ../../../node_modules/.pnpm/bail@2.0.2/node_modules/bail/index.js
|
|
5932
5932
|
function bail(error) {
|
|
@@ -40036,10 +40036,22 @@ var Xh = Q({ "src/language-js/parse/acorn-and-espree.js"(a, u) {
|
|
|
40036
40036
|
var mc = Xh();
|
|
40037
40037
|
|
|
40038
40038
|
// src/stringify/acorn.ts
|
|
40039
|
-
|
|
40040
|
-
|
|
40039
|
+
function generateRandom6LetterString() {
|
|
40040
|
+
const characters = "abcdefghijklmnopqrstuvwxyz";
|
|
40041
|
+
let result = "";
|
|
40042
|
+
for (let i = 0; i < 6; i++) {
|
|
40043
|
+
const randomIndex = Math.floor(Math.random() * characters.length);
|
|
40044
|
+
result += characters[randomIndex];
|
|
40045
|
+
}
|
|
40046
|
+
return result;
|
|
40047
|
+
}
|
|
40048
|
+
function isMultiline(input) {
|
|
40049
|
+
return input.includes("\n") || input.includes("\r");
|
|
40050
|
+
}
|
|
40051
|
+
var stringifyPropsInline = (element, field, imageCallback, context) => {
|
|
40052
|
+
return stringifyProps(element, field, true, imageCallback, context || {});
|
|
40041
40053
|
};
|
|
40042
|
-
function stringifyProps(element, parentField, flatten2, imageCallback) {
|
|
40054
|
+
function stringifyProps(element, parentField, flatten2, imageCallback, context) {
|
|
40043
40055
|
var _a3, _b;
|
|
40044
40056
|
const attributes2 = [];
|
|
40045
40057
|
const children = [];
|
|
@@ -40065,6 +40077,16 @@ function stringifyProps(element, parentField, flatten2, imageCallback) {
|
|
|
40065
40077
|
if (template.fields.find((f) => f.name === "children")) {
|
|
40066
40078
|
directiveType = "block";
|
|
40067
40079
|
}
|
|
40080
|
+
const embedCodes = {};
|
|
40081
|
+
for (const [embedKey, value] of Object.entries(element.props)) {
|
|
40082
|
+
if (embedKey.startsWith("_tinaEmbeds")) {
|
|
40083
|
+
const key = embedKey.replace("_tinaEmbeds.", "");
|
|
40084
|
+
embedCodes[key] = value;
|
|
40085
|
+
}
|
|
40086
|
+
}
|
|
40087
|
+
for (const key of Object.keys(embedCodes)) {
|
|
40088
|
+
delete element.props[`_tinaEmbeds.${key}`];
|
|
40089
|
+
}
|
|
40068
40090
|
useDirective = !!template.match;
|
|
40069
40091
|
Object.entries(element.props).forEach(([name2, value]) => {
|
|
40070
40092
|
var _a4;
|
|
@@ -40116,11 +40138,22 @@ function stringifyProps(element, parentField, flatten2, imageCallback) {
|
|
|
40116
40138
|
}
|
|
40117
40139
|
} else {
|
|
40118
40140
|
if (typeof value === "string") {
|
|
40119
|
-
|
|
40120
|
-
|
|
40121
|
-
|
|
40122
|
-
value
|
|
40123
|
-
|
|
40141
|
+
if (isMultiline(value)) {
|
|
40142
|
+
const code3 = embedCodes[name2] || generateRandom6LetterString();
|
|
40143
|
+
context._tinaEmbeds = context._tinaEmbeds || {};
|
|
40144
|
+
context._tinaEmbeds[code3] = value;
|
|
40145
|
+
attributes2.push({
|
|
40146
|
+
type: "mdxJsxAttribute",
|
|
40147
|
+
name: name2,
|
|
40148
|
+
value: `_tinaEmbeds.${code3}`
|
|
40149
|
+
});
|
|
40150
|
+
} else {
|
|
40151
|
+
attributes2.push({
|
|
40152
|
+
type: "mdxJsxAttribute",
|
|
40153
|
+
name: name2,
|
|
40154
|
+
value
|
|
40155
|
+
});
|
|
40156
|
+
}
|
|
40124
40157
|
} else {
|
|
40125
40158
|
throw new Error(
|
|
40126
40159
|
`Expected string for attribute on field ${field.name}`
|
|
@@ -40206,39 +40239,23 @@ function stringifyProps(element, parentField, flatten2, imageCallback) {
|
|
|
40206
40239
|
(value2) => value2.type === "root" && Array.isArray(value2.children),
|
|
40207
40240
|
`Nested rich-text element is not a valid shape for field ${field.name}`
|
|
40208
40241
|
);
|
|
40242
|
+
const code3 = value.embedCode || generateRandom6LetterString();
|
|
40209
40243
|
if (field.name === "children") {
|
|
40210
|
-
const root2 = rootElement(value, field, imageCallback);
|
|
40244
|
+
const root2 = rootElement(value, field, imageCallback, context);
|
|
40211
40245
|
root2.children.forEach((child) => {
|
|
40212
40246
|
children.push(child);
|
|
40213
40247
|
});
|
|
40214
40248
|
return;
|
|
40215
40249
|
} else {
|
|
40216
40250
|
const stringValue = stringifyMDX(value, field, imageCallback);
|
|
40217
|
-
|
|
40218
|
-
|
|
40219
|
-
}
|
|
40220
|
-
}
|
|
40221
|
-
if (flatten2) {
|
|
40222
|
-
attributes2.push({
|
|
40223
|
-
type: "mdxJsxAttribute",
|
|
40224
|
-
name: name2,
|
|
40225
|
-
value: {
|
|
40226
|
-
type: "mdxJsxAttributeValueExpression",
|
|
40227
|
-
value: `<>${val.trim()}</>`
|
|
40228
|
-
}
|
|
40229
|
-
});
|
|
40230
|
-
} else {
|
|
40231
|
-
attributes2.push({
|
|
40232
|
-
type: "mdxJsxAttribute",
|
|
40233
|
-
name: name2,
|
|
40234
|
-
value: {
|
|
40235
|
-
type: "mdxJsxAttributeValueExpression",
|
|
40236
|
-
value: `<>
|
|
40237
|
-
${val}
|
|
40238
|
-
</>`
|
|
40239
|
-
}
|
|
40240
|
-
});
|
|
40251
|
+
context._tinaEmbeds = context._tinaEmbeds || {};
|
|
40252
|
+
context._tinaEmbeds[code3] = stringValue;
|
|
40241
40253
|
}
|
|
40254
|
+
attributes2.push({
|
|
40255
|
+
type: "mdxJsxAttribute",
|
|
40256
|
+
name: name2,
|
|
40257
|
+
value: `_tinaEmbeds.${code3}`
|
|
40258
|
+
});
|
|
40242
40259
|
}
|
|
40243
40260
|
break;
|
|
40244
40261
|
default:
|
|
@@ -40504,7 +40521,7 @@ var eat2 = (c, field, imageCallback) => {
|
|
|
40504
40521
|
}
|
|
40505
40522
|
if (markToProcess === "inlineCode") {
|
|
40506
40523
|
if (nonMatchingSiblingIndex) {
|
|
40507
|
-
throw new Error(
|
|
40524
|
+
throw new Error("Marks inside inline code are not supported");
|
|
40508
40525
|
}
|
|
40509
40526
|
const node2 = {
|
|
40510
40527
|
type: markToProcess,
|
|
@@ -40539,7 +40556,8 @@ var cleanNode = (node2, mark) => {
|
|
|
40539
40556
|
const markToClear = {
|
|
40540
40557
|
strong: "bold",
|
|
40541
40558
|
emphasis: "italic",
|
|
40542
|
-
inlineCode: "code"
|
|
40559
|
+
inlineCode: "code",
|
|
40560
|
+
delete: "strikethrough"
|
|
40543
40561
|
}[mark];
|
|
40544
40562
|
Object.entries(node2).map(([key, value]) => {
|
|
40545
40563
|
if (key !== markToClear) {
|
|
@@ -40676,7 +40694,7 @@ ${match.start} /${match.name || template.name} ${match.end}`;
|
|
|
40676
40694
|
}
|
|
40677
40695
|
|
|
40678
40696
|
// src/stringify/index.ts
|
|
40679
|
-
var stringifyMDX = (value, field, imageCallback) => {
|
|
40697
|
+
var stringifyMDX = (value, field, imageCallback, context = {}) => {
|
|
40680
40698
|
var _a3, _b;
|
|
40681
40699
|
if (((_a3 = field.parser) == null ? void 0 : _a3.type) === "markdown") {
|
|
40682
40700
|
return stringifyMDX2(value, field, imageCallback);
|
|
@@ -40692,7 +40710,7 @@ var stringifyMDX = (value, field, imageCallback) => {
|
|
|
40692
40710
|
return value.children[0].value;
|
|
40693
40711
|
}
|
|
40694
40712
|
}
|
|
40695
|
-
const tree = rootElement(value, field, imageCallback);
|
|
40713
|
+
const tree = rootElement(value, field, imageCallback, context);
|
|
40696
40714
|
const res = toTinaMarkdown2(tree, field);
|
|
40697
40715
|
const templatesWithMatchers = (_b = field.templates) == null ? void 0 : _b.filter(
|
|
40698
40716
|
(template) => template.match
|
|
@@ -40755,11 +40773,11 @@ var toTinaMarkdown2 = (tree, field) => {
|
|
|
40755
40773
|
handlers
|
|
40756
40774
|
});
|
|
40757
40775
|
};
|
|
40758
|
-
var rootElement = (content3, field, imageCallback) => {
|
|
40776
|
+
var rootElement = (content3, field, imageCallback, context) => {
|
|
40759
40777
|
var _a3;
|
|
40760
40778
|
const children = [];
|
|
40761
40779
|
(_a3 = content3.children) == null ? void 0 : _a3.forEach((child) => {
|
|
40762
|
-
const value = blockElement(child, field, imageCallback);
|
|
40780
|
+
const value = blockElement(child, field, imageCallback, context);
|
|
40763
40781
|
if (value) {
|
|
40764
40782
|
children.push(value);
|
|
40765
40783
|
}
|
|
@@ -40769,7 +40787,7 @@ var rootElement = (content3, field, imageCallback) => {
|
|
|
40769
40787
|
children
|
|
40770
40788
|
};
|
|
40771
40789
|
};
|
|
40772
|
-
var blockElement = (content3, field, imageCallback) => {
|
|
40790
|
+
var blockElement = (content3, field, imageCallback, context) => {
|
|
40773
40791
|
switch (content3.type) {
|
|
40774
40792
|
case "h1":
|
|
40775
40793
|
case "h2":
|
|
@@ -40832,7 +40850,7 @@ var blockElement = (content3, field, imageCallback) => {
|
|
|
40832
40850
|
})
|
|
40833
40851
|
};
|
|
40834
40852
|
}
|
|
40835
|
-
const { children, attributes: attributes2, useDirective, directiveType } = stringifyProps(content3, field, false, imageCallback);
|
|
40853
|
+
const { children, attributes: attributes2, useDirective, directiveType } = stringifyProps(content3, field, false, imageCallback, context);
|
|
40836
40854
|
if (useDirective) {
|
|
40837
40855
|
const name2 = content3.name;
|
|
40838
40856
|
if (!name2) {
|
|
@@ -41003,6 +41021,9 @@ var getMarks = (content3) => {
|
|
|
41003
41021
|
if (content3.code) {
|
|
41004
41022
|
marks.push("inlineCode");
|
|
41005
41023
|
}
|
|
41024
|
+
if (content3.strikethrough) {
|
|
41025
|
+
marks.push("delete");
|
|
41026
|
+
}
|
|
41006
41027
|
return marks;
|
|
41007
41028
|
};
|
|
41008
41029
|
|
|
@@ -41451,7 +41472,8 @@ var cleanNode2 = (node2, mark) => {
|
|
|
41451
41472
|
const markToClear = {
|
|
41452
41473
|
strong: "bold",
|
|
41453
41474
|
emphasis: "italic",
|
|
41454
|
-
inlineCode: "code"
|
|
41475
|
+
inlineCode: "code",
|
|
41476
|
+
delete: "strikethrough"
|
|
41455
41477
|
}[mark];
|
|
41456
41478
|
Object.entries(node2).map(([key, value]) => {
|
|
41457
41479
|
if (key !== markToClear) {
|
|
@@ -44008,7 +44030,7 @@ function compact(tree) {
|
|
|
44008
44030
|
var import_lodash = __toESM(require_lodash());
|
|
44009
44031
|
|
|
44010
44032
|
// src/parse/acorn.ts
|
|
44011
|
-
var extractAttributes = (attributes2, fields, imageCallback) => {
|
|
44033
|
+
var extractAttributes = (attributes2, fields, imageCallback, context) => {
|
|
44012
44034
|
const properties = {};
|
|
44013
44035
|
attributes2 == null ? void 0 : attributes2.forEach((attribute) => {
|
|
44014
44036
|
assertType(attribute, "mdxJsxAttribute");
|
|
@@ -44022,7 +44044,9 @@ var extractAttributes = (attributes2, fields, imageCallback) => {
|
|
|
44022
44044
|
properties[attribute.name] = extractAttribute(
|
|
44023
44045
|
attribute,
|
|
44024
44046
|
field,
|
|
44025
|
-
imageCallback
|
|
44047
|
+
imageCallback,
|
|
44048
|
+
context,
|
|
44049
|
+
(name2, value) => properties[name2] = value
|
|
44026
44050
|
);
|
|
44027
44051
|
} catch (e) {
|
|
44028
44052
|
if (e instanceof Error) {
|
|
@@ -44035,7 +44059,7 @@ var extractAttributes = (attributes2, fields, imageCallback) => {
|
|
|
44035
44059
|
});
|
|
44036
44060
|
return properties;
|
|
44037
44061
|
};
|
|
44038
|
-
var extractAttribute = (attribute, field, imageCallback) => {
|
|
44062
|
+
var extractAttribute = (attribute, field, imageCallback, context, addProperty) => {
|
|
44039
44063
|
switch (field.type) {
|
|
44040
44064
|
case "boolean":
|
|
44041
44065
|
case "number":
|
|
@@ -44045,7 +44069,7 @@ var extractAttribute = (attribute, field, imageCallback) => {
|
|
|
44045
44069
|
if (field.list) {
|
|
44046
44070
|
return extractScalar(extractExpression(attribute), field);
|
|
44047
44071
|
} else {
|
|
44048
|
-
return extractString(attribute, field);
|
|
44072
|
+
return extractString(attribute, field, context, addProperty);
|
|
44049
44073
|
}
|
|
44050
44074
|
case "image":
|
|
44051
44075
|
if (field.list) {
|
|
@@ -44055,18 +44079,35 @@ var extractAttribute = (attribute, field, imageCallback) => {
|
|
|
44055
44079
|
);
|
|
44056
44080
|
return values2.split(",").map((value) => imageCallback(value));
|
|
44057
44081
|
} else {
|
|
44058
|
-
const value = extractString(attribute, field);
|
|
44082
|
+
const value = extractString(attribute, field, context, addProperty);
|
|
44059
44083
|
return imageCallback(value);
|
|
44060
44084
|
}
|
|
44061
44085
|
case "reference":
|
|
44062
44086
|
if (field.list) {
|
|
44063
44087
|
return extractScalar(extractExpression(attribute), field);
|
|
44064
44088
|
} else {
|
|
44065
|
-
return extractString(attribute, field);
|
|
44089
|
+
return extractString(attribute, field, context, addProperty);
|
|
44066
44090
|
}
|
|
44067
44091
|
case "object":
|
|
44068
44092
|
return extractObject(extractExpression(attribute), field, imageCallback);
|
|
44069
44093
|
case "rich-text":
|
|
44094
|
+
if (attribute.type === "mdxJsxAttribute") {
|
|
44095
|
+
if (typeof attribute.value === "string") {
|
|
44096
|
+
if (attribute.value.startsWith("_tinaEmbeds")) {
|
|
44097
|
+
const embedValue = context == null ? void 0 : context._tinaEmbeds;
|
|
44098
|
+
const key = attribute.value.split(".")[1];
|
|
44099
|
+
if (typeof key !== "string") {
|
|
44100
|
+
throw new Error(`Unable to extract key from embed value`);
|
|
44101
|
+
}
|
|
44102
|
+
const value = embedValue[key];
|
|
44103
|
+
if (typeof value === "string") {
|
|
44104
|
+
const ast = parseMDX(value, field, imageCallback, context);
|
|
44105
|
+
ast.embedCode = attribute.value.split(".")[1];
|
|
44106
|
+
return ast;
|
|
44107
|
+
}
|
|
44108
|
+
}
|
|
44109
|
+
}
|
|
44110
|
+
}
|
|
44070
44111
|
const JSXString = extractRaw(attribute);
|
|
44071
44112
|
if (JSXString) {
|
|
44072
44113
|
return parseMDX(JSXString, field, imageCallback);
|
|
@@ -44174,9 +44215,21 @@ var extractStatement = (attribute) => {
|
|
|
44174
44215
|
}
|
|
44175
44216
|
throw new Error(`Unable to extract body from expression`);
|
|
44176
44217
|
};
|
|
44177
|
-
var extractString = (attribute, field) => {
|
|
44218
|
+
var extractString = (attribute, field, context, addProperty) => {
|
|
44178
44219
|
if (attribute.type === "mdxJsxAttribute") {
|
|
44179
44220
|
if (typeof attribute.value === "string") {
|
|
44221
|
+
if (attribute.value.startsWith("_tinaEmbeds")) {
|
|
44222
|
+
const embedValue = context == null ? void 0 : context._tinaEmbeds;
|
|
44223
|
+
const key = attribute.value.split(".")[1];
|
|
44224
|
+
if (typeof key !== "string") {
|
|
44225
|
+
throw new Error(`Unable to extract key from embed value`);
|
|
44226
|
+
}
|
|
44227
|
+
const value = embedValue[key];
|
|
44228
|
+
if (typeof value === "string") {
|
|
44229
|
+
addProperty == null ? void 0 : addProperty(`_tinaEmbeds.${attribute.name}`, key);
|
|
44230
|
+
return value;
|
|
44231
|
+
}
|
|
44232
|
+
}
|
|
44180
44233
|
return attribute.value;
|
|
44181
44234
|
}
|
|
44182
44235
|
}
|
|
@@ -44301,7 +44354,7 @@ function source(value, file) {
|
|
|
44301
44354
|
}
|
|
44302
44355
|
|
|
44303
44356
|
// src/parse/mdx.ts
|
|
44304
|
-
function mdxJsxElement(node2, field, imageCallback) {
|
|
44357
|
+
function mdxJsxElement(node2, field, imageCallback, context) {
|
|
44305
44358
|
var _a3;
|
|
44306
44359
|
try {
|
|
44307
44360
|
const template = (_a3 = field.templates) == null ? void 0 : _a3.find((template2) => {
|
|
@@ -44322,7 +44375,8 @@ function mdxJsxElement(node2, field, imageCallback) {
|
|
|
44322
44375
|
const props = extractAttributes(
|
|
44323
44376
|
node2.attributes,
|
|
44324
44377
|
template.fields,
|
|
44325
|
-
imageCallback
|
|
44378
|
+
imageCallback,
|
|
44379
|
+
context
|
|
44326
44380
|
);
|
|
44327
44381
|
const childField = template.fields.find(
|
|
44328
44382
|
(field2) => field2.name === "children"
|
|
@@ -44392,7 +44446,7 @@ var directiveElement = (node2, field, imageCallback, raw) => {
|
|
|
44392
44446
|
};
|
|
44393
44447
|
|
|
44394
44448
|
// src/parse/remarkToPlate.ts
|
|
44395
|
-
var remarkToSlate = (root2, field, imageCallback, raw, skipMDXProcess) => {
|
|
44449
|
+
var remarkToSlate = (root2, field, imageCallback, raw, skipMDXProcess, context) => {
|
|
44396
44450
|
const mdxJsxElement2 = skipMDXProcess ? (node2) => node2 : mdxJsxElement;
|
|
44397
44451
|
const content3 = (content4) => {
|
|
44398
44452
|
var _a3;
|
|
@@ -44444,7 +44498,7 @@ var remarkToSlate = (root2, field, imageCallback, raw, skipMDXProcess) => {
|
|
|
44444
44498
|
case "paragraph":
|
|
44445
44499
|
return paragraph2(content4);
|
|
44446
44500
|
case "mdxJsxFlowElement":
|
|
44447
|
-
return mdxJsxElement2(content4, field, imageCallback);
|
|
44501
|
+
return mdxJsxElement2(content4, field, imageCallback, context);
|
|
44448
44502
|
case "thematicBreak":
|
|
44449
44503
|
return {
|
|
44450
44504
|
type: "hr",
|
|
@@ -44540,7 +44594,8 @@ var remarkToSlate = (root2, field, imageCallback, raw, skipMDXProcess) => {
|
|
|
44540
44594
|
mdxJsxElement2(
|
|
44541
44595
|
{ ...child, type: "mdxJsxTextElement" },
|
|
44542
44596
|
field,
|
|
44543
|
-
imageCallback
|
|
44597
|
+
imageCallback,
|
|
44598
|
+
context
|
|
44544
44599
|
)
|
|
44545
44600
|
]
|
|
44546
44601
|
};
|
|
@@ -44653,7 +44708,7 @@ var remarkToSlate = (root2, field, imageCallback, raw, skipMDXProcess) => {
|
|
|
44653
44708
|
const staticPhrasingContent = (content4) => {
|
|
44654
44709
|
switch (content4.type) {
|
|
44655
44710
|
case "mdxJsxTextElement":
|
|
44656
|
-
return mdxJsxElement2(content4, field, imageCallback);
|
|
44711
|
+
return mdxJsxElement2(content4, field, imageCallback, context);
|
|
44657
44712
|
case "text":
|
|
44658
44713
|
return text7(content4);
|
|
44659
44714
|
case "inlineCode":
|
|
@@ -44673,12 +44728,14 @@ var remarkToSlate = (root2, field, imageCallback, raw, skipMDXProcess) => {
|
|
|
44673
44728
|
switch (content4.type) {
|
|
44674
44729
|
case "text":
|
|
44675
44730
|
return text7(content4);
|
|
44731
|
+
case "delete":
|
|
44732
|
+
return phrashingMark(content4);
|
|
44676
44733
|
case "link":
|
|
44677
44734
|
return link2(content4);
|
|
44678
44735
|
case "image":
|
|
44679
44736
|
return image2(content4);
|
|
44680
44737
|
case "mdxJsxTextElement":
|
|
44681
|
-
return mdxJsxElement2(content4, field, imageCallback);
|
|
44738
|
+
return mdxJsxElement2(content4, field, imageCallback, context);
|
|
44682
44739
|
case "emphasis":
|
|
44683
44740
|
return phrashingMark(content4);
|
|
44684
44741
|
case "strong":
|
|
@@ -44737,6 +44794,17 @@ var remarkToSlate = (root2, field, imageCallback, raw, skipMDXProcess) => {
|
|
|
44737
44794
|
});
|
|
44738
44795
|
break;
|
|
44739
44796
|
}
|
|
44797
|
+
case "delete": {
|
|
44798
|
+
const children = (0, import_lodash.default)(
|
|
44799
|
+
node2.children.map(
|
|
44800
|
+
(child) => phrashingMark(child, [...marks, "strikethrough"])
|
|
44801
|
+
)
|
|
44802
|
+
);
|
|
44803
|
+
children.forEach((child) => {
|
|
44804
|
+
accum.push(child);
|
|
44805
|
+
});
|
|
44806
|
+
break;
|
|
44807
|
+
}
|
|
44740
44808
|
case "strong": {
|
|
44741
44809
|
const children = (0, import_lodash.default)(
|
|
44742
44810
|
node2.children.map((child) => phrashingMark(child, [...marks, "bold"]))
|
|
@@ -44940,7 +45008,7 @@ var mdxToAst = (value) => {
|
|
|
44940
45008
|
return remark().use(remarkMdx).use(remarkGfm).parse(value);
|
|
44941
45009
|
};
|
|
44942
45010
|
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";
|
|
44943
|
-
var parseMDX = (value, field, imageCallback) => {
|
|
45011
|
+
var parseMDX = (value, field, imageCallback, context) => {
|
|
44944
45012
|
var _a3, _b;
|
|
44945
45013
|
if (!value) {
|
|
44946
45014
|
return { type: "root", children: [] };
|
|
@@ -44966,7 +45034,7 @@ var parseMDX = (value, field, imageCallback) => {
|
|
|
44966
45034
|
});
|
|
44967
45035
|
tree = mdxToAst(preprocessedString);
|
|
44968
45036
|
if (tree) {
|
|
44969
|
-
return remarkToSlate(tree, field, imageCallback, value);
|
|
45037
|
+
return remarkToSlate(tree, field, imageCallback, value, false, context);
|
|
44970
45038
|
} else {
|
|
44971
45039
|
return { type: "root", children: [] };
|
|
44972
45040
|
}
|