@tinacms/mdx 1.8.1 → 1.8.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.
- package/dist/index.browser.mjs +24 -125
- package/dist/index.js +24 -125
- package/dist/index.mjs +24 -125
- package/dist/parse/index.d.ts +2 -2
- package/dist/parse/remarkToPlate.d.ts +3 -3
- package/package.json +3 -5
package/dist/index.browser.mjs
CHANGED
|
@@ -6360,82 +6360,6 @@ var require_acorn_jsx = __commonJS({
|
|
|
6360
6360
|
}
|
|
6361
6361
|
});
|
|
6362
6362
|
|
|
6363
|
-
// ../../../node_modules/.pnpm/lodash.flatten@4.4.0/node_modules/lodash.flatten/index.js
|
|
6364
|
-
var require_lodash = __commonJS({
|
|
6365
|
-
"../../../node_modules/.pnpm/lodash.flatten@4.4.0/node_modules/lodash.flatten/index.js"(exports, module) {
|
|
6366
|
-
var MAX_SAFE_INTEGER = 9007199254740991;
|
|
6367
|
-
var argsTag = "[object Arguments]";
|
|
6368
|
-
var funcTag = "[object Function]";
|
|
6369
|
-
var genTag = "[object GeneratorFunction]";
|
|
6370
|
-
var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
|
|
6371
|
-
var freeSelf = typeof self == "object" && self && self.Object === Object && self;
|
|
6372
|
-
var root2 = freeGlobal || freeSelf || Function("return this")();
|
|
6373
|
-
function arrayPush(array, values2) {
|
|
6374
|
-
var index2 = -1, length = values2.length, offset3 = array.length;
|
|
6375
|
-
while (++index2 < length) {
|
|
6376
|
-
array[offset3 + index2] = values2[index2];
|
|
6377
|
-
}
|
|
6378
|
-
return array;
|
|
6379
|
-
}
|
|
6380
|
-
var objectProto = Object.prototype;
|
|
6381
|
-
var hasOwnProperty4 = objectProto.hasOwnProperty;
|
|
6382
|
-
var objectToString = objectProto.toString;
|
|
6383
|
-
var Symbol2 = root2.Symbol;
|
|
6384
|
-
var propertyIsEnumerable = objectProto.propertyIsEnumerable;
|
|
6385
|
-
var spreadableSymbol = Symbol2 ? Symbol2.isConcatSpreadable : void 0;
|
|
6386
|
-
function baseFlatten(array, depth, predicate, isStrict, result) {
|
|
6387
|
-
var index2 = -1, length = array.length;
|
|
6388
|
-
predicate || (predicate = isFlattenable);
|
|
6389
|
-
result || (result = []);
|
|
6390
|
-
while (++index2 < length) {
|
|
6391
|
-
var value = array[index2];
|
|
6392
|
-
if (depth > 0 && predicate(value)) {
|
|
6393
|
-
if (depth > 1) {
|
|
6394
|
-
baseFlatten(value, depth - 1, predicate, isStrict, result);
|
|
6395
|
-
} else {
|
|
6396
|
-
arrayPush(result, value);
|
|
6397
|
-
}
|
|
6398
|
-
} else if (!isStrict) {
|
|
6399
|
-
result[result.length] = value;
|
|
6400
|
-
}
|
|
6401
|
-
}
|
|
6402
|
-
return result;
|
|
6403
|
-
}
|
|
6404
|
-
function isFlattenable(value) {
|
|
6405
|
-
return isArray3(value) || isArguments(value) || !!(spreadableSymbol && value && value[spreadableSymbol]);
|
|
6406
|
-
}
|
|
6407
|
-
function flatten2(array) {
|
|
6408
|
-
var length = array ? array.length : 0;
|
|
6409
|
-
return length ? baseFlatten(array, 1) : [];
|
|
6410
|
-
}
|
|
6411
|
-
function isArguments(value) {
|
|
6412
|
-
return isArrayLikeObject(value) && hasOwnProperty4.call(value, "callee") && (!propertyIsEnumerable.call(value, "callee") || objectToString.call(value) == argsTag);
|
|
6413
|
-
}
|
|
6414
|
-
var isArray3 = Array.isArray;
|
|
6415
|
-
function isArrayLike(value) {
|
|
6416
|
-
return value != null && isLength(value.length) && !isFunction(value);
|
|
6417
|
-
}
|
|
6418
|
-
function isArrayLikeObject(value) {
|
|
6419
|
-
return isObjectLike(value) && isArrayLike(value);
|
|
6420
|
-
}
|
|
6421
|
-
function isFunction(value) {
|
|
6422
|
-
var tag = isObject2(value) ? objectToString.call(value) : "";
|
|
6423
|
-
return tag == funcTag || tag == genTag;
|
|
6424
|
-
}
|
|
6425
|
-
function isLength(value) {
|
|
6426
|
-
return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
|
|
6427
|
-
}
|
|
6428
|
-
function isObject2(value) {
|
|
6429
|
-
var type = typeof value;
|
|
6430
|
-
return !!value && (type == "object" || type == "function");
|
|
6431
|
-
}
|
|
6432
|
-
function isObjectLike(value) {
|
|
6433
|
-
return !!value && typeof value == "object";
|
|
6434
|
-
}
|
|
6435
|
-
module.exports = flatten2;
|
|
6436
|
-
}
|
|
6437
|
-
});
|
|
6438
|
-
|
|
6439
6363
|
// ../../../node_modules/.pnpm/mdast-util-to-string@3.2.0/node_modules/mdast-util-to-string/lib/index.js
|
|
6440
6364
|
var emptyOptions = {};
|
|
6441
6365
|
function toString(value, options) {
|
|
@@ -40828,7 +40752,7 @@ var Ty = Rg();
|
|
|
40828
40752
|
var stringifyPropsInline = (element2, field, imageCallback) => {
|
|
40829
40753
|
return stringifyProps(element2, field, true, imageCallback);
|
|
40830
40754
|
};
|
|
40831
|
-
function stringifyProps(element2, parentField,
|
|
40755
|
+
function stringifyProps(element2, parentField, flatten, imageCallback) {
|
|
40832
40756
|
const attributes2 = [];
|
|
40833
40757
|
const children = [];
|
|
40834
40758
|
let template;
|
|
@@ -40969,7 +40893,7 @@ function stringifyProps(element2, parentField, flatten2, imageCallback) {
|
|
|
40969
40893
|
name: name2,
|
|
40970
40894
|
value: {
|
|
40971
40895
|
type: "mdxJsxAttributeValueExpression",
|
|
40972
|
-
value: stringifyObj(result,
|
|
40896
|
+
value: stringifyObj(result, flatten)
|
|
40973
40897
|
}
|
|
40974
40898
|
});
|
|
40975
40899
|
break;
|
|
@@ -40982,7 +40906,7 @@ function stringifyProps(element2, parentField, flatten2, imageCallback) {
|
|
|
40982
40906
|
if (field.list) {
|
|
40983
40907
|
throw new Error(`Rich-text list is not supported`);
|
|
40984
40908
|
} else {
|
|
40985
|
-
const joiner =
|
|
40909
|
+
const joiner = flatten ? " " : "\n";
|
|
40986
40910
|
let val = "";
|
|
40987
40911
|
if (isPlainObject2(value) && Object.keys(value).length === 0) {
|
|
40988
40912
|
return;
|
|
@@ -41004,7 +40928,7 @@ function stringifyProps(element2, parentField, flatten2, imageCallback) {
|
|
|
41004
40928
|
val = stringValue.trim().split("\n").map((str) => ` ${str.trim()}`).join(joiner);
|
|
41005
40929
|
}
|
|
41006
40930
|
}
|
|
41007
|
-
if (
|
|
40931
|
+
if (flatten) {
|
|
41008
40932
|
attributes2.push({
|
|
41009
40933
|
type: "mdxJsxAttribute",
|
|
41010
40934
|
name: name2,
|
|
@@ -41051,7 +40975,7 @@ ${val}
|
|
|
41051
40975
|
}
|
|
41052
40976
|
return { attributes: attributes2, children, useDirective, directiveType };
|
|
41053
40977
|
}
|
|
41054
|
-
function stringifyObj(obj,
|
|
40978
|
+
function stringifyObj(obj, flatten) {
|
|
41055
40979
|
if (typeof obj === "object" && obj !== null) {
|
|
41056
40980
|
const dummyFunc = `const dummyFunc = `;
|
|
41057
40981
|
const res = Ty.format(`${dummyFunc}${JSON.stringify(obj)}`, {
|
|
@@ -41060,7 +40984,7 @@ function stringifyObj(obj, flatten2) {
|
|
|
41060
40984
|
semi: false,
|
|
41061
40985
|
plugins: [mc]
|
|
41062
40986
|
}).trim().replace(dummyFunc, "");
|
|
41063
|
-
return
|
|
40987
|
+
return flatten ? res.replaceAll("\n", "").replaceAll(" ", " ") : res;
|
|
41064
40988
|
} else {
|
|
41065
40989
|
throw new Error(
|
|
41066
40990
|
`stringifyObj must be passed an object or an array of objects, received ${typeof obj}`
|
|
@@ -41685,7 +41609,7 @@ var getMarks = (content3) => {
|
|
|
41685
41609
|
var stringifyPropsInline2 = (element2, field, imageCallback) => {
|
|
41686
41610
|
return stringifyProps2(element2, field, true, imageCallback);
|
|
41687
41611
|
};
|
|
41688
|
-
function stringifyProps2(element2, parentField,
|
|
41612
|
+
function stringifyProps2(element2, parentField, flatten, imageCallback) {
|
|
41689
41613
|
const attributes2 = [];
|
|
41690
41614
|
const children = [];
|
|
41691
41615
|
let template;
|
|
@@ -41821,7 +41745,7 @@ function stringifyProps2(element2, parentField, flatten2, imageCallback) {
|
|
|
41821
41745
|
name: name2,
|
|
41822
41746
|
value: {
|
|
41823
41747
|
type: "mdxJsxAttributeValueExpression",
|
|
41824
|
-
value: stringifyObj2(value,
|
|
41748
|
+
value: stringifyObj2(value, flatten)
|
|
41825
41749
|
}
|
|
41826
41750
|
});
|
|
41827
41751
|
break;
|
|
@@ -41834,7 +41758,7 @@ function stringifyProps2(element2, parentField, flatten2, imageCallback) {
|
|
|
41834
41758
|
if (field.list) {
|
|
41835
41759
|
throw new Error(`Rich-text list is not supported`);
|
|
41836
41760
|
} else {
|
|
41837
|
-
const joiner =
|
|
41761
|
+
const joiner = flatten ? " " : "\n";
|
|
41838
41762
|
let val = "";
|
|
41839
41763
|
assertShape2(
|
|
41840
41764
|
value,
|
|
@@ -41853,7 +41777,7 @@ function stringifyProps2(element2, parentField, flatten2, imageCallback) {
|
|
|
41853
41777
|
val = stringValue.trim().split("\n").map((str) => ` ${str.trim()}`).join(joiner);
|
|
41854
41778
|
}
|
|
41855
41779
|
}
|
|
41856
|
-
if (
|
|
41780
|
+
if (flatten) {
|
|
41857
41781
|
attributes2.push({
|
|
41858
41782
|
type: "mdxJsxAttribute",
|
|
41859
41783
|
name: name2,
|
|
@@ -41900,7 +41824,7 @@ ${val}
|
|
|
41900
41824
|
}
|
|
41901
41825
|
return { attributes: attributes2, children, useDirective, directiveType };
|
|
41902
41826
|
}
|
|
41903
|
-
function stringifyObj2(obj,
|
|
41827
|
+
function stringifyObj2(obj, flatten) {
|
|
41904
41828
|
if (typeof obj === "object" && obj !== null) {
|
|
41905
41829
|
const dummyFunc = `const dummyFunc = `;
|
|
41906
41830
|
const res = Ty.format(`${dummyFunc}${JSON.stringify(obj)}`, {
|
|
@@ -41909,7 +41833,7 @@ function stringifyObj2(obj, flatten2) {
|
|
|
41909
41833
|
semi: false,
|
|
41910
41834
|
plugins: [mc]
|
|
41911
41835
|
}).trim().replace(dummyFunc, "");
|
|
41912
|
-
return
|
|
41836
|
+
return flatten ? res.replaceAll("\n", "").replaceAll(" ", " ") : res;
|
|
41913
41837
|
} else {
|
|
41914
41838
|
throw new Error(
|
|
41915
41839
|
`stringifyObj must be passed an object or an array of objects, received ${typeof obj}`
|
|
@@ -48159,9 +48083,6 @@ function compact(tree) {
|
|
|
48159
48083
|
return tree;
|
|
48160
48084
|
}
|
|
48161
48085
|
|
|
48162
|
-
// src/parse/remarkToPlate.ts
|
|
48163
|
-
var import_lodash = __toESM(require_lodash());
|
|
48164
|
-
|
|
48165
48086
|
// src/parse/acorn.ts
|
|
48166
48087
|
var extractAttributes = (attributes2, fields, imageCallback) => {
|
|
48167
48088
|
const properties = {};
|
|
@@ -48558,11 +48479,7 @@ var remarkToSlate = (root2, field, imageCallback, raw, skipMDXProcess) => {
|
|
|
48558
48479
|
children: [
|
|
48559
48480
|
{
|
|
48560
48481
|
type: "p",
|
|
48561
|
-
children: (
|
|
48562
|
-
tableCell.children.map(
|
|
48563
|
-
(child) => phrasingContent(child)
|
|
48564
|
-
)
|
|
48565
|
-
)
|
|
48482
|
+
children: tableCell.children.map((child) => phrasingContent(child)).flat()
|
|
48566
48483
|
}
|
|
48567
48484
|
]
|
|
48568
48485
|
};
|
|
@@ -48605,9 +48522,7 @@ var remarkToSlate = (root2, field, imageCallback, raw, skipMDXProcess) => {
|
|
|
48605
48522
|
children: [
|
|
48606
48523
|
{
|
|
48607
48524
|
type: "lic",
|
|
48608
|
-
children: (
|
|
48609
|
-
content4.children.map((child) => unwrapBlockContent(child))
|
|
48610
|
-
)
|
|
48525
|
+
children: content4.children.map((child) => unwrapBlockContent(child)).flat()
|
|
48611
48526
|
}
|
|
48612
48527
|
]
|
|
48613
48528
|
};
|
|
@@ -48671,9 +48586,7 @@ var remarkToSlate = (root2, field, imageCallback, raw, skipMDXProcess) => {
|
|
|
48671
48586
|
case "paragraph":
|
|
48672
48587
|
return {
|
|
48673
48588
|
type: "lic",
|
|
48674
|
-
children: (
|
|
48675
|
-
child.children.map((child2) => phrasingContent(child2))
|
|
48676
|
-
)
|
|
48589
|
+
children: child.children.map((child2) => phrasingContent(child2)).flat()
|
|
48677
48590
|
};
|
|
48678
48591
|
case "blockquote": {
|
|
48679
48592
|
return {
|
|
@@ -48736,7 +48649,7 @@ var remarkToSlate = (root2, field, imageCallback, raw, skipMDXProcess) => {
|
|
|
48736
48649
|
const unwrapBlockContent = (content4) => {
|
|
48737
48650
|
const flattenPhrasingContent = (children) => {
|
|
48738
48651
|
const children2 = children.map((child) => phrasingContent(child));
|
|
48739
|
-
return (
|
|
48652
|
+
return (Array.isArray(children2) ? children2 : [children2]).flat();
|
|
48740
48653
|
};
|
|
48741
48654
|
switch (content4.type) {
|
|
48742
48655
|
case "heading":
|
|
@@ -48786,15 +48699,13 @@ var remarkToSlate = (root2, field, imageCallback, raw, skipMDXProcess) => {
|
|
|
48786
48699
|
type: "a",
|
|
48787
48700
|
url: sanitizeUrl(content4.url),
|
|
48788
48701
|
title: content4.title,
|
|
48789
|
-
children: (
|
|
48790
|
-
content4.children.map((child) => staticPhrasingContent(child))
|
|
48791
|
-
)
|
|
48702
|
+
children: content4.children.map((child) => staticPhrasingContent(child)).flat()
|
|
48792
48703
|
};
|
|
48793
48704
|
};
|
|
48794
48705
|
const heading2 = (content4) => {
|
|
48795
48706
|
return {
|
|
48796
48707
|
type: ["h1", "h2", "h3", "h4", "h5", "h6"][content4.depth - 1],
|
|
48797
|
-
children:
|
|
48708
|
+
children: content4.children.map(phrasingContent).flat()
|
|
48798
48709
|
};
|
|
48799
48710
|
};
|
|
48800
48711
|
const staticPhrasingContent = (content4) => {
|
|
@@ -48867,11 +48778,7 @@ var remarkToSlate = (root2, field, imageCallback, raw, skipMDXProcess) => {
|
|
|
48867
48778
|
const accum = [];
|
|
48868
48779
|
switch (node2.type) {
|
|
48869
48780
|
case "emphasis": {
|
|
48870
|
-
const children = (
|
|
48871
|
-
node2.children.map(
|
|
48872
|
-
(child) => phrashingMark(child, [...marks, "italic"])
|
|
48873
|
-
)
|
|
48874
|
-
);
|
|
48781
|
+
const children = node2.children.map((child) => phrashingMark(child, [...marks, "italic"])).flat();
|
|
48875
48782
|
children.forEach((child) => {
|
|
48876
48783
|
accum.push(child);
|
|
48877
48784
|
});
|
|
@@ -48889,20 +48796,14 @@ var remarkToSlate = (root2, field, imageCallback, raw, skipMDXProcess) => {
|
|
|
48889
48796
|
break;
|
|
48890
48797
|
}
|
|
48891
48798
|
case "delete": {
|
|
48892
|
-
const children = (
|
|
48893
|
-
node2.children.map(
|
|
48894
|
-
(child) => phrashingMark(child, [...marks, "strikethrough"])
|
|
48895
|
-
)
|
|
48896
|
-
);
|
|
48799
|
+
const children = node2.children.map((child) => phrashingMark(child, [...marks, "strikethrough"])).flat();
|
|
48897
48800
|
children.forEach((child) => {
|
|
48898
48801
|
accum.push(child);
|
|
48899
48802
|
});
|
|
48900
48803
|
break;
|
|
48901
48804
|
}
|
|
48902
48805
|
case "strong": {
|
|
48903
|
-
const children = (
|
|
48904
|
-
node2.children.map((child) => phrashingMark(child, [...marks, "bold"]))
|
|
48905
|
-
);
|
|
48806
|
+
const children = node2.children.map((child) => phrashingMark(child, [...marks, "bold"])).flat();
|
|
48906
48807
|
children.forEach((child) => {
|
|
48907
48808
|
accum.push(child);
|
|
48908
48809
|
});
|
|
@@ -48913,9 +48814,7 @@ var remarkToSlate = (root2, field, imageCallback, raw, skipMDXProcess) => {
|
|
|
48913
48814
|
break;
|
|
48914
48815
|
}
|
|
48915
48816
|
case "link": {
|
|
48916
|
-
const children = (
|
|
48917
|
-
node2.children.map((child) => phrashingMark(child, marks))
|
|
48918
|
-
);
|
|
48817
|
+
const children = node2.children.map((child) => phrashingMark(child, marks)).flat();
|
|
48919
48818
|
accum.push({
|
|
48920
48819
|
type: "a",
|
|
48921
48820
|
url: sanitizeUrl(node2.url),
|
|
@@ -48977,7 +48876,7 @@ var remarkToSlate = (root2, field, imageCallback, raw, skipMDXProcess) => {
|
|
|
48977
48876
|
};
|
|
48978
48877
|
};
|
|
48979
48878
|
const paragraph2 = (content4) => {
|
|
48980
|
-
const children =
|
|
48879
|
+
const children = content4.children.map(phrasingContent).flat();
|
|
48981
48880
|
if (children.length === 1) {
|
|
48982
48881
|
if (children[0]) {
|
|
48983
48882
|
if (children[0].type === "html_inline") {
|
|
@@ -49101,7 +49000,7 @@ function parseShortcode(preprocessedString, template) {
|
|
|
49101
49000
|
var mdxToAst = (value) => {
|
|
49102
49001
|
return remark().use(remarkMdx).use(remarkGfm).parse(value);
|
|
49103
49002
|
};
|
|
49104
|
-
var MDX_PARSE_ERROR_MSG = "TinaCMS supports a stricter version of markdown and a subset of MDX. https://tina.io/docs/
|
|
49003
|
+
var MDX_PARSE_ERROR_MSG = "TinaCMS supports a stricter version of markdown and a subset of MDX. https://tina.io/docs/r/what-is-markdown";
|
|
49105
49004
|
var parseMDX = (value, field, imageCallback) => {
|
|
49106
49005
|
if (!value) {
|
|
49107
49006
|
return { type: "root", children: [] };
|
package/dist/index.js
CHANGED
|
@@ -6360,82 +6360,6 @@ var require_acorn_jsx = __commonJS({
|
|
|
6360
6360
|
}
|
|
6361
6361
|
});
|
|
6362
6362
|
|
|
6363
|
-
// ../../../node_modules/.pnpm/lodash.flatten@4.4.0/node_modules/lodash.flatten/index.js
|
|
6364
|
-
var require_lodash = __commonJS({
|
|
6365
|
-
"../../../node_modules/.pnpm/lodash.flatten@4.4.0/node_modules/lodash.flatten/index.js"(exports2, module2) {
|
|
6366
|
-
var MAX_SAFE_INTEGER = 9007199254740991;
|
|
6367
|
-
var argsTag = "[object Arguments]";
|
|
6368
|
-
var funcTag = "[object Function]";
|
|
6369
|
-
var genTag = "[object GeneratorFunction]";
|
|
6370
|
-
var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
|
|
6371
|
-
var freeSelf = typeof self == "object" && self && self.Object === Object && self;
|
|
6372
|
-
var root2 = freeGlobal || freeSelf || Function("return this")();
|
|
6373
|
-
function arrayPush(array, values2) {
|
|
6374
|
-
var index2 = -1, length = values2.length, offset3 = array.length;
|
|
6375
|
-
while (++index2 < length) {
|
|
6376
|
-
array[offset3 + index2] = values2[index2];
|
|
6377
|
-
}
|
|
6378
|
-
return array;
|
|
6379
|
-
}
|
|
6380
|
-
var objectProto = Object.prototype;
|
|
6381
|
-
var hasOwnProperty4 = objectProto.hasOwnProperty;
|
|
6382
|
-
var objectToString = objectProto.toString;
|
|
6383
|
-
var Symbol2 = root2.Symbol;
|
|
6384
|
-
var propertyIsEnumerable = objectProto.propertyIsEnumerable;
|
|
6385
|
-
var spreadableSymbol = Symbol2 ? Symbol2.isConcatSpreadable : void 0;
|
|
6386
|
-
function baseFlatten(array, depth, predicate, isStrict, result) {
|
|
6387
|
-
var index2 = -1, length = array.length;
|
|
6388
|
-
predicate || (predicate = isFlattenable);
|
|
6389
|
-
result || (result = []);
|
|
6390
|
-
while (++index2 < length) {
|
|
6391
|
-
var value = array[index2];
|
|
6392
|
-
if (depth > 0 && predicate(value)) {
|
|
6393
|
-
if (depth > 1) {
|
|
6394
|
-
baseFlatten(value, depth - 1, predicate, isStrict, result);
|
|
6395
|
-
} else {
|
|
6396
|
-
arrayPush(result, value);
|
|
6397
|
-
}
|
|
6398
|
-
} else if (!isStrict) {
|
|
6399
|
-
result[result.length] = value;
|
|
6400
|
-
}
|
|
6401
|
-
}
|
|
6402
|
-
return result;
|
|
6403
|
-
}
|
|
6404
|
-
function isFlattenable(value) {
|
|
6405
|
-
return isArray3(value) || isArguments(value) || !!(spreadableSymbol && value && value[spreadableSymbol]);
|
|
6406
|
-
}
|
|
6407
|
-
function flatten2(array) {
|
|
6408
|
-
var length = array ? array.length : 0;
|
|
6409
|
-
return length ? baseFlatten(array, 1) : [];
|
|
6410
|
-
}
|
|
6411
|
-
function isArguments(value) {
|
|
6412
|
-
return isArrayLikeObject(value) && hasOwnProperty4.call(value, "callee") && (!propertyIsEnumerable.call(value, "callee") || objectToString.call(value) == argsTag);
|
|
6413
|
-
}
|
|
6414
|
-
var isArray3 = Array.isArray;
|
|
6415
|
-
function isArrayLike(value) {
|
|
6416
|
-
return value != null && isLength(value.length) && !isFunction(value);
|
|
6417
|
-
}
|
|
6418
|
-
function isArrayLikeObject(value) {
|
|
6419
|
-
return isObjectLike(value) && isArrayLike(value);
|
|
6420
|
-
}
|
|
6421
|
-
function isFunction(value) {
|
|
6422
|
-
var tag = isObject2(value) ? objectToString.call(value) : "";
|
|
6423
|
-
return tag == funcTag || tag == genTag;
|
|
6424
|
-
}
|
|
6425
|
-
function isLength(value) {
|
|
6426
|
-
return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
|
|
6427
|
-
}
|
|
6428
|
-
function isObject2(value) {
|
|
6429
|
-
var type = typeof value;
|
|
6430
|
-
return !!value && (type == "object" || type == "function");
|
|
6431
|
-
}
|
|
6432
|
-
function isObjectLike(value) {
|
|
6433
|
-
return !!value && typeof value == "object";
|
|
6434
|
-
}
|
|
6435
|
-
module2.exports = flatten2;
|
|
6436
|
-
}
|
|
6437
|
-
});
|
|
6438
|
-
|
|
6439
6363
|
// src/index.ts
|
|
6440
6364
|
var index_exports = {};
|
|
6441
6365
|
__export(index_exports, {
|
|
@@ -42706,7 +42630,7 @@ var Ty = Rg();
|
|
|
42706
42630
|
var stringifyPropsInline = (element, field, imageCallback) => {
|
|
42707
42631
|
return stringifyProps(element, field, true, imageCallback);
|
|
42708
42632
|
};
|
|
42709
|
-
function stringifyProps(element, parentField,
|
|
42633
|
+
function stringifyProps(element, parentField, flatten, imageCallback) {
|
|
42710
42634
|
const attributes2 = [];
|
|
42711
42635
|
const children = [];
|
|
42712
42636
|
let template;
|
|
@@ -42847,7 +42771,7 @@ function stringifyProps(element, parentField, flatten2, imageCallback) {
|
|
|
42847
42771
|
name: name2,
|
|
42848
42772
|
value: {
|
|
42849
42773
|
type: "mdxJsxAttributeValueExpression",
|
|
42850
|
-
value: stringifyObj(result,
|
|
42774
|
+
value: stringifyObj(result, flatten)
|
|
42851
42775
|
}
|
|
42852
42776
|
});
|
|
42853
42777
|
break;
|
|
@@ -42860,7 +42784,7 @@ function stringifyProps(element, parentField, flatten2, imageCallback) {
|
|
|
42860
42784
|
if (field.list) {
|
|
42861
42785
|
throw new Error(`Rich-text list is not supported`);
|
|
42862
42786
|
} else {
|
|
42863
|
-
const joiner =
|
|
42787
|
+
const joiner = flatten ? " " : "\n";
|
|
42864
42788
|
let val = "";
|
|
42865
42789
|
if (isPlainObject2(value) && Object.keys(value).length === 0) {
|
|
42866
42790
|
return;
|
|
@@ -42882,7 +42806,7 @@ function stringifyProps(element, parentField, flatten2, imageCallback) {
|
|
|
42882
42806
|
val = stringValue.trim().split("\n").map((str) => ` ${str.trim()}`).join(joiner);
|
|
42883
42807
|
}
|
|
42884
42808
|
}
|
|
42885
|
-
if (
|
|
42809
|
+
if (flatten) {
|
|
42886
42810
|
attributes2.push({
|
|
42887
42811
|
type: "mdxJsxAttribute",
|
|
42888
42812
|
name: name2,
|
|
@@ -42929,7 +42853,7 @@ ${val}
|
|
|
42929
42853
|
}
|
|
42930
42854
|
return { attributes: attributes2, children, useDirective, directiveType };
|
|
42931
42855
|
}
|
|
42932
|
-
function stringifyObj(obj,
|
|
42856
|
+
function stringifyObj(obj, flatten) {
|
|
42933
42857
|
if (typeof obj === "object" && obj !== null) {
|
|
42934
42858
|
const dummyFunc = `const dummyFunc = `;
|
|
42935
42859
|
const res = Ty.format(`${dummyFunc}${JSON.stringify(obj)}`, {
|
|
@@ -42938,7 +42862,7 @@ function stringifyObj(obj, flatten2) {
|
|
|
42938
42862
|
semi: false,
|
|
42939
42863
|
plugins: [mc]
|
|
42940
42864
|
}).trim().replace(dummyFunc, "");
|
|
42941
|
-
return
|
|
42865
|
+
return flatten ? res.replaceAll("\n", "").replaceAll(" ", " ") : res;
|
|
42942
42866
|
} else {
|
|
42943
42867
|
throw new Error(
|
|
42944
42868
|
`stringifyObj must be passed an object or an array of objects, received ${typeof obj}`
|
|
@@ -43563,7 +43487,7 @@ var getMarks = (content3) => {
|
|
|
43563
43487
|
var stringifyPropsInline2 = (element, field, imageCallback) => {
|
|
43564
43488
|
return stringifyProps2(element, field, true, imageCallback);
|
|
43565
43489
|
};
|
|
43566
|
-
function stringifyProps2(element, parentField,
|
|
43490
|
+
function stringifyProps2(element, parentField, flatten, imageCallback) {
|
|
43567
43491
|
const attributes2 = [];
|
|
43568
43492
|
const children = [];
|
|
43569
43493
|
let template;
|
|
@@ -43699,7 +43623,7 @@ function stringifyProps2(element, parentField, flatten2, imageCallback) {
|
|
|
43699
43623
|
name: name2,
|
|
43700
43624
|
value: {
|
|
43701
43625
|
type: "mdxJsxAttributeValueExpression",
|
|
43702
|
-
value: stringifyObj2(value,
|
|
43626
|
+
value: stringifyObj2(value, flatten)
|
|
43703
43627
|
}
|
|
43704
43628
|
});
|
|
43705
43629
|
break;
|
|
@@ -43712,7 +43636,7 @@ function stringifyProps2(element, parentField, flatten2, imageCallback) {
|
|
|
43712
43636
|
if (field.list) {
|
|
43713
43637
|
throw new Error(`Rich-text list is not supported`);
|
|
43714
43638
|
} else {
|
|
43715
|
-
const joiner =
|
|
43639
|
+
const joiner = flatten ? " " : "\n";
|
|
43716
43640
|
let val = "";
|
|
43717
43641
|
assertShape2(
|
|
43718
43642
|
value,
|
|
@@ -43731,7 +43655,7 @@ function stringifyProps2(element, parentField, flatten2, imageCallback) {
|
|
|
43731
43655
|
val = stringValue.trim().split("\n").map((str) => ` ${str.trim()}`).join(joiner);
|
|
43732
43656
|
}
|
|
43733
43657
|
}
|
|
43734
|
-
if (
|
|
43658
|
+
if (flatten) {
|
|
43735
43659
|
attributes2.push({
|
|
43736
43660
|
type: "mdxJsxAttribute",
|
|
43737
43661
|
name: name2,
|
|
@@ -43778,7 +43702,7 @@ ${val}
|
|
|
43778
43702
|
}
|
|
43779
43703
|
return { attributes: attributes2, children, useDirective, directiveType };
|
|
43780
43704
|
}
|
|
43781
|
-
function stringifyObj2(obj,
|
|
43705
|
+
function stringifyObj2(obj, flatten) {
|
|
43782
43706
|
if (typeof obj === "object" && obj !== null) {
|
|
43783
43707
|
const dummyFunc = `const dummyFunc = `;
|
|
43784
43708
|
const res = Ty.format(`${dummyFunc}${JSON.stringify(obj)}`, {
|
|
@@ -43787,7 +43711,7 @@ function stringifyObj2(obj, flatten2) {
|
|
|
43787
43711
|
semi: false,
|
|
43788
43712
|
plugins: [mc]
|
|
43789
43713
|
}).trim().replace(dummyFunc, "");
|
|
43790
|
-
return
|
|
43714
|
+
return flatten ? res.replaceAll("\n", "").replaceAll(" ", " ") : res;
|
|
43791
43715
|
} else {
|
|
43792
43716
|
throw new Error(
|
|
43793
43717
|
`stringifyObj must be passed an object or an array of objects, received ${typeof obj}`
|
|
@@ -50037,9 +49961,6 @@ function compact(tree) {
|
|
|
50037
49961
|
return tree;
|
|
50038
49962
|
}
|
|
50039
49963
|
|
|
50040
|
-
// src/parse/remarkToPlate.ts
|
|
50041
|
-
var import_lodash = __toESM(require_lodash());
|
|
50042
|
-
|
|
50043
49964
|
// src/parse/acorn.ts
|
|
50044
49965
|
var extractAttributes = (attributes2, fields, imageCallback) => {
|
|
50045
49966
|
const properties = {};
|
|
@@ -50436,11 +50357,7 @@ var remarkToSlate = (root2, field, imageCallback, raw, skipMDXProcess) => {
|
|
|
50436
50357
|
children: [
|
|
50437
50358
|
{
|
|
50438
50359
|
type: "p",
|
|
50439
|
-
children: (
|
|
50440
|
-
tableCell.children.map(
|
|
50441
|
-
(child) => phrasingContent(child)
|
|
50442
|
-
)
|
|
50443
|
-
)
|
|
50360
|
+
children: tableCell.children.map((child) => phrasingContent(child)).flat()
|
|
50444
50361
|
}
|
|
50445
50362
|
]
|
|
50446
50363
|
};
|
|
@@ -50483,9 +50400,7 @@ var remarkToSlate = (root2, field, imageCallback, raw, skipMDXProcess) => {
|
|
|
50483
50400
|
children: [
|
|
50484
50401
|
{
|
|
50485
50402
|
type: "lic",
|
|
50486
|
-
children: (
|
|
50487
|
-
content4.children.map((child) => unwrapBlockContent(child))
|
|
50488
|
-
)
|
|
50403
|
+
children: content4.children.map((child) => unwrapBlockContent(child)).flat()
|
|
50489
50404
|
}
|
|
50490
50405
|
]
|
|
50491
50406
|
};
|
|
@@ -50549,9 +50464,7 @@ var remarkToSlate = (root2, field, imageCallback, raw, skipMDXProcess) => {
|
|
|
50549
50464
|
case "paragraph":
|
|
50550
50465
|
return {
|
|
50551
50466
|
type: "lic",
|
|
50552
|
-
children: (
|
|
50553
|
-
child.children.map((child2) => phrasingContent(child2))
|
|
50554
|
-
)
|
|
50467
|
+
children: child.children.map((child2) => phrasingContent(child2)).flat()
|
|
50555
50468
|
};
|
|
50556
50469
|
case "blockquote": {
|
|
50557
50470
|
return {
|
|
@@ -50614,7 +50527,7 @@ var remarkToSlate = (root2, field, imageCallback, raw, skipMDXProcess) => {
|
|
|
50614
50527
|
const unwrapBlockContent = (content4) => {
|
|
50615
50528
|
const flattenPhrasingContent = (children) => {
|
|
50616
50529
|
const children2 = children.map((child) => phrasingContent(child));
|
|
50617
|
-
return (
|
|
50530
|
+
return (Array.isArray(children2) ? children2 : [children2]).flat();
|
|
50618
50531
|
};
|
|
50619
50532
|
switch (content4.type) {
|
|
50620
50533
|
case "heading":
|
|
@@ -50664,15 +50577,13 @@ var remarkToSlate = (root2, field, imageCallback, raw, skipMDXProcess) => {
|
|
|
50664
50577
|
type: "a",
|
|
50665
50578
|
url: sanitizeUrl(content4.url),
|
|
50666
50579
|
title: content4.title,
|
|
50667
|
-
children: (
|
|
50668
|
-
content4.children.map((child) => staticPhrasingContent(child))
|
|
50669
|
-
)
|
|
50580
|
+
children: content4.children.map((child) => staticPhrasingContent(child)).flat()
|
|
50670
50581
|
};
|
|
50671
50582
|
};
|
|
50672
50583
|
const heading2 = (content4) => {
|
|
50673
50584
|
return {
|
|
50674
50585
|
type: ["h1", "h2", "h3", "h4", "h5", "h6"][content4.depth - 1],
|
|
50675
|
-
children:
|
|
50586
|
+
children: content4.children.map(phrasingContent).flat()
|
|
50676
50587
|
};
|
|
50677
50588
|
};
|
|
50678
50589
|
const staticPhrasingContent = (content4) => {
|
|
@@ -50745,11 +50656,7 @@ var remarkToSlate = (root2, field, imageCallback, raw, skipMDXProcess) => {
|
|
|
50745
50656
|
const accum = [];
|
|
50746
50657
|
switch (node2.type) {
|
|
50747
50658
|
case "emphasis": {
|
|
50748
|
-
const children = (
|
|
50749
|
-
node2.children.map(
|
|
50750
|
-
(child) => phrashingMark(child, [...marks, "italic"])
|
|
50751
|
-
)
|
|
50752
|
-
);
|
|
50659
|
+
const children = node2.children.map((child) => phrashingMark(child, [...marks, "italic"])).flat();
|
|
50753
50660
|
children.forEach((child) => {
|
|
50754
50661
|
accum.push(child);
|
|
50755
50662
|
});
|
|
@@ -50767,20 +50674,14 @@ var remarkToSlate = (root2, field, imageCallback, raw, skipMDXProcess) => {
|
|
|
50767
50674
|
break;
|
|
50768
50675
|
}
|
|
50769
50676
|
case "delete": {
|
|
50770
|
-
const children = (
|
|
50771
|
-
node2.children.map(
|
|
50772
|
-
(child) => phrashingMark(child, [...marks, "strikethrough"])
|
|
50773
|
-
)
|
|
50774
|
-
);
|
|
50677
|
+
const children = node2.children.map((child) => phrashingMark(child, [...marks, "strikethrough"])).flat();
|
|
50775
50678
|
children.forEach((child) => {
|
|
50776
50679
|
accum.push(child);
|
|
50777
50680
|
});
|
|
50778
50681
|
break;
|
|
50779
50682
|
}
|
|
50780
50683
|
case "strong": {
|
|
50781
|
-
const children = (
|
|
50782
|
-
node2.children.map((child) => phrashingMark(child, [...marks, "bold"]))
|
|
50783
|
-
);
|
|
50684
|
+
const children = node2.children.map((child) => phrashingMark(child, [...marks, "bold"])).flat();
|
|
50784
50685
|
children.forEach((child) => {
|
|
50785
50686
|
accum.push(child);
|
|
50786
50687
|
});
|
|
@@ -50791,9 +50692,7 @@ var remarkToSlate = (root2, field, imageCallback, raw, skipMDXProcess) => {
|
|
|
50791
50692
|
break;
|
|
50792
50693
|
}
|
|
50793
50694
|
case "link": {
|
|
50794
|
-
const children = (
|
|
50795
|
-
node2.children.map((child) => phrashingMark(child, marks))
|
|
50796
|
-
);
|
|
50695
|
+
const children = node2.children.map((child) => phrashingMark(child, marks)).flat();
|
|
50797
50696
|
accum.push({
|
|
50798
50697
|
type: "a",
|
|
50799
50698
|
url: sanitizeUrl(node2.url),
|
|
@@ -50855,7 +50754,7 @@ var remarkToSlate = (root2, field, imageCallback, raw, skipMDXProcess) => {
|
|
|
50855
50754
|
};
|
|
50856
50755
|
};
|
|
50857
50756
|
const paragraph2 = (content4) => {
|
|
50858
|
-
const children =
|
|
50757
|
+
const children = content4.children.map(phrasingContent).flat();
|
|
50859
50758
|
if (children.length === 1) {
|
|
50860
50759
|
if (children[0]) {
|
|
50861
50760
|
if (children[0].type === "html_inline") {
|
|
@@ -50979,7 +50878,7 @@ function parseShortcode(preprocessedString, template) {
|
|
|
50979
50878
|
var mdxToAst = (value) => {
|
|
50980
50879
|
return remark().use(remarkMdx).use(remarkGfm).parse(value);
|
|
50981
50880
|
};
|
|
50982
|
-
var MDX_PARSE_ERROR_MSG = "TinaCMS supports a stricter version of markdown and a subset of MDX. https://tina.io/docs/
|
|
50881
|
+
var MDX_PARSE_ERROR_MSG = "TinaCMS supports a stricter version of markdown and a subset of MDX. https://tina.io/docs/r/what-is-markdown";
|
|
50983
50882
|
var parseMDX = (value, field, imageCallback) => {
|
|
50984
50883
|
if (!value) {
|
|
50985
50884
|
return { type: "root", children: [] };
|
package/dist/index.mjs
CHANGED
|
@@ -6360,82 +6360,6 @@ var require_acorn_jsx = __commonJS({
|
|
|
6360
6360
|
}
|
|
6361
6361
|
});
|
|
6362
6362
|
|
|
6363
|
-
// ../../../node_modules/.pnpm/lodash.flatten@4.4.0/node_modules/lodash.flatten/index.js
|
|
6364
|
-
var require_lodash = __commonJS({
|
|
6365
|
-
"../../../node_modules/.pnpm/lodash.flatten@4.4.0/node_modules/lodash.flatten/index.js"(exports, module) {
|
|
6366
|
-
var MAX_SAFE_INTEGER = 9007199254740991;
|
|
6367
|
-
var argsTag = "[object Arguments]";
|
|
6368
|
-
var funcTag = "[object Function]";
|
|
6369
|
-
var genTag = "[object GeneratorFunction]";
|
|
6370
|
-
var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
|
|
6371
|
-
var freeSelf = typeof self == "object" && self && self.Object === Object && self;
|
|
6372
|
-
var root2 = freeGlobal || freeSelf || Function("return this")();
|
|
6373
|
-
function arrayPush(array, values2) {
|
|
6374
|
-
var index2 = -1, length = values2.length, offset3 = array.length;
|
|
6375
|
-
while (++index2 < length) {
|
|
6376
|
-
array[offset3 + index2] = values2[index2];
|
|
6377
|
-
}
|
|
6378
|
-
return array;
|
|
6379
|
-
}
|
|
6380
|
-
var objectProto = Object.prototype;
|
|
6381
|
-
var hasOwnProperty4 = objectProto.hasOwnProperty;
|
|
6382
|
-
var objectToString = objectProto.toString;
|
|
6383
|
-
var Symbol2 = root2.Symbol;
|
|
6384
|
-
var propertyIsEnumerable = objectProto.propertyIsEnumerable;
|
|
6385
|
-
var spreadableSymbol = Symbol2 ? Symbol2.isConcatSpreadable : void 0;
|
|
6386
|
-
function baseFlatten(array, depth, predicate, isStrict, result) {
|
|
6387
|
-
var index2 = -1, length = array.length;
|
|
6388
|
-
predicate || (predicate = isFlattenable);
|
|
6389
|
-
result || (result = []);
|
|
6390
|
-
while (++index2 < length) {
|
|
6391
|
-
var value = array[index2];
|
|
6392
|
-
if (depth > 0 && predicate(value)) {
|
|
6393
|
-
if (depth > 1) {
|
|
6394
|
-
baseFlatten(value, depth - 1, predicate, isStrict, result);
|
|
6395
|
-
} else {
|
|
6396
|
-
arrayPush(result, value);
|
|
6397
|
-
}
|
|
6398
|
-
} else if (!isStrict) {
|
|
6399
|
-
result[result.length] = value;
|
|
6400
|
-
}
|
|
6401
|
-
}
|
|
6402
|
-
return result;
|
|
6403
|
-
}
|
|
6404
|
-
function isFlattenable(value) {
|
|
6405
|
-
return isArray3(value) || isArguments(value) || !!(spreadableSymbol && value && value[spreadableSymbol]);
|
|
6406
|
-
}
|
|
6407
|
-
function flatten2(array) {
|
|
6408
|
-
var length = array ? array.length : 0;
|
|
6409
|
-
return length ? baseFlatten(array, 1) : [];
|
|
6410
|
-
}
|
|
6411
|
-
function isArguments(value) {
|
|
6412
|
-
return isArrayLikeObject(value) && hasOwnProperty4.call(value, "callee") && (!propertyIsEnumerable.call(value, "callee") || objectToString.call(value) == argsTag);
|
|
6413
|
-
}
|
|
6414
|
-
var isArray3 = Array.isArray;
|
|
6415
|
-
function isArrayLike(value) {
|
|
6416
|
-
return value != null && isLength(value.length) && !isFunction(value);
|
|
6417
|
-
}
|
|
6418
|
-
function isArrayLikeObject(value) {
|
|
6419
|
-
return isObjectLike(value) && isArrayLike(value);
|
|
6420
|
-
}
|
|
6421
|
-
function isFunction(value) {
|
|
6422
|
-
var tag = isObject2(value) ? objectToString.call(value) : "";
|
|
6423
|
-
return tag == funcTag || tag == genTag;
|
|
6424
|
-
}
|
|
6425
|
-
function isLength(value) {
|
|
6426
|
-
return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
|
|
6427
|
-
}
|
|
6428
|
-
function isObject2(value) {
|
|
6429
|
-
var type = typeof value;
|
|
6430
|
-
return !!value && (type == "object" || type == "function");
|
|
6431
|
-
}
|
|
6432
|
-
function isObjectLike(value) {
|
|
6433
|
-
return !!value && typeof value == "object";
|
|
6434
|
-
}
|
|
6435
|
-
module.exports = flatten2;
|
|
6436
|
-
}
|
|
6437
|
-
});
|
|
6438
|
-
|
|
6439
6363
|
// ../../../node_modules/.pnpm/mdast-util-to-string@3.2.0/node_modules/mdast-util-to-string/lib/index.js
|
|
6440
6364
|
var emptyOptions = {};
|
|
6441
6365
|
function toString(value, options) {
|
|
@@ -42698,7 +42622,7 @@ var Ty = Rg();
|
|
|
42698
42622
|
var stringifyPropsInline = (element, field, imageCallback) => {
|
|
42699
42623
|
return stringifyProps(element, field, true, imageCallback);
|
|
42700
42624
|
};
|
|
42701
|
-
function stringifyProps(element, parentField,
|
|
42625
|
+
function stringifyProps(element, parentField, flatten, imageCallback) {
|
|
42702
42626
|
const attributes2 = [];
|
|
42703
42627
|
const children = [];
|
|
42704
42628
|
let template;
|
|
@@ -42839,7 +42763,7 @@ function stringifyProps(element, parentField, flatten2, imageCallback) {
|
|
|
42839
42763
|
name: name2,
|
|
42840
42764
|
value: {
|
|
42841
42765
|
type: "mdxJsxAttributeValueExpression",
|
|
42842
|
-
value: stringifyObj(result,
|
|
42766
|
+
value: stringifyObj(result, flatten)
|
|
42843
42767
|
}
|
|
42844
42768
|
});
|
|
42845
42769
|
break;
|
|
@@ -42852,7 +42776,7 @@ function stringifyProps(element, parentField, flatten2, imageCallback) {
|
|
|
42852
42776
|
if (field.list) {
|
|
42853
42777
|
throw new Error(`Rich-text list is not supported`);
|
|
42854
42778
|
} else {
|
|
42855
|
-
const joiner =
|
|
42779
|
+
const joiner = flatten ? " " : "\n";
|
|
42856
42780
|
let val = "";
|
|
42857
42781
|
if (isPlainObject2(value) && Object.keys(value).length === 0) {
|
|
42858
42782
|
return;
|
|
@@ -42874,7 +42798,7 @@ function stringifyProps(element, parentField, flatten2, imageCallback) {
|
|
|
42874
42798
|
val = stringValue.trim().split("\n").map((str) => ` ${str.trim()}`).join(joiner);
|
|
42875
42799
|
}
|
|
42876
42800
|
}
|
|
42877
|
-
if (
|
|
42801
|
+
if (flatten) {
|
|
42878
42802
|
attributes2.push({
|
|
42879
42803
|
type: "mdxJsxAttribute",
|
|
42880
42804
|
name: name2,
|
|
@@ -42921,7 +42845,7 @@ ${val}
|
|
|
42921
42845
|
}
|
|
42922
42846
|
return { attributes: attributes2, children, useDirective, directiveType };
|
|
42923
42847
|
}
|
|
42924
|
-
function stringifyObj(obj,
|
|
42848
|
+
function stringifyObj(obj, flatten) {
|
|
42925
42849
|
if (typeof obj === "object" && obj !== null) {
|
|
42926
42850
|
const dummyFunc = `const dummyFunc = `;
|
|
42927
42851
|
const res = Ty.format(`${dummyFunc}${JSON.stringify(obj)}`, {
|
|
@@ -42930,7 +42854,7 @@ function stringifyObj(obj, flatten2) {
|
|
|
42930
42854
|
semi: false,
|
|
42931
42855
|
plugins: [mc]
|
|
42932
42856
|
}).trim().replace(dummyFunc, "");
|
|
42933
|
-
return
|
|
42857
|
+
return flatten ? res.replaceAll("\n", "").replaceAll(" ", " ") : res;
|
|
42934
42858
|
} else {
|
|
42935
42859
|
throw new Error(
|
|
42936
42860
|
`stringifyObj must be passed an object or an array of objects, received ${typeof obj}`
|
|
@@ -43555,7 +43479,7 @@ var getMarks = (content3) => {
|
|
|
43555
43479
|
var stringifyPropsInline2 = (element, field, imageCallback) => {
|
|
43556
43480
|
return stringifyProps2(element, field, true, imageCallback);
|
|
43557
43481
|
};
|
|
43558
|
-
function stringifyProps2(element, parentField,
|
|
43482
|
+
function stringifyProps2(element, parentField, flatten, imageCallback) {
|
|
43559
43483
|
const attributes2 = [];
|
|
43560
43484
|
const children = [];
|
|
43561
43485
|
let template;
|
|
@@ -43691,7 +43615,7 @@ function stringifyProps2(element, parentField, flatten2, imageCallback) {
|
|
|
43691
43615
|
name: name2,
|
|
43692
43616
|
value: {
|
|
43693
43617
|
type: "mdxJsxAttributeValueExpression",
|
|
43694
|
-
value: stringifyObj2(value,
|
|
43618
|
+
value: stringifyObj2(value, flatten)
|
|
43695
43619
|
}
|
|
43696
43620
|
});
|
|
43697
43621
|
break;
|
|
@@ -43704,7 +43628,7 @@ function stringifyProps2(element, parentField, flatten2, imageCallback) {
|
|
|
43704
43628
|
if (field.list) {
|
|
43705
43629
|
throw new Error(`Rich-text list is not supported`);
|
|
43706
43630
|
} else {
|
|
43707
|
-
const joiner =
|
|
43631
|
+
const joiner = flatten ? " " : "\n";
|
|
43708
43632
|
let val = "";
|
|
43709
43633
|
assertShape2(
|
|
43710
43634
|
value,
|
|
@@ -43723,7 +43647,7 @@ function stringifyProps2(element, parentField, flatten2, imageCallback) {
|
|
|
43723
43647
|
val = stringValue.trim().split("\n").map((str) => ` ${str.trim()}`).join(joiner);
|
|
43724
43648
|
}
|
|
43725
43649
|
}
|
|
43726
|
-
if (
|
|
43650
|
+
if (flatten) {
|
|
43727
43651
|
attributes2.push({
|
|
43728
43652
|
type: "mdxJsxAttribute",
|
|
43729
43653
|
name: name2,
|
|
@@ -43770,7 +43694,7 @@ ${val}
|
|
|
43770
43694
|
}
|
|
43771
43695
|
return { attributes: attributes2, children, useDirective, directiveType };
|
|
43772
43696
|
}
|
|
43773
|
-
function stringifyObj2(obj,
|
|
43697
|
+
function stringifyObj2(obj, flatten) {
|
|
43774
43698
|
if (typeof obj === "object" && obj !== null) {
|
|
43775
43699
|
const dummyFunc = `const dummyFunc = `;
|
|
43776
43700
|
const res = Ty.format(`${dummyFunc}${JSON.stringify(obj)}`, {
|
|
@@ -43779,7 +43703,7 @@ function stringifyObj2(obj, flatten2) {
|
|
|
43779
43703
|
semi: false,
|
|
43780
43704
|
plugins: [mc]
|
|
43781
43705
|
}).trim().replace(dummyFunc, "");
|
|
43782
|
-
return
|
|
43706
|
+
return flatten ? res.replaceAll("\n", "").replaceAll(" ", " ") : res;
|
|
43783
43707
|
} else {
|
|
43784
43708
|
throw new Error(
|
|
43785
43709
|
`stringifyObj must be passed an object or an array of objects, received ${typeof obj}`
|
|
@@ -50029,9 +49953,6 @@ function compact(tree) {
|
|
|
50029
49953
|
return tree;
|
|
50030
49954
|
}
|
|
50031
49955
|
|
|
50032
|
-
// src/parse/remarkToPlate.ts
|
|
50033
|
-
var import_lodash = __toESM(require_lodash());
|
|
50034
|
-
|
|
50035
49956
|
// src/parse/acorn.ts
|
|
50036
49957
|
var extractAttributes = (attributes2, fields, imageCallback) => {
|
|
50037
49958
|
const properties = {};
|
|
@@ -50428,11 +50349,7 @@ var remarkToSlate = (root2, field, imageCallback, raw, skipMDXProcess) => {
|
|
|
50428
50349
|
children: [
|
|
50429
50350
|
{
|
|
50430
50351
|
type: "p",
|
|
50431
|
-
children: (
|
|
50432
|
-
tableCell.children.map(
|
|
50433
|
-
(child) => phrasingContent(child)
|
|
50434
|
-
)
|
|
50435
|
-
)
|
|
50352
|
+
children: tableCell.children.map((child) => phrasingContent(child)).flat()
|
|
50436
50353
|
}
|
|
50437
50354
|
]
|
|
50438
50355
|
};
|
|
@@ -50475,9 +50392,7 @@ var remarkToSlate = (root2, field, imageCallback, raw, skipMDXProcess) => {
|
|
|
50475
50392
|
children: [
|
|
50476
50393
|
{
|
|
50477
50394
|
type: "lic",
|
|
50478
|
-
children: (
|
|
50479
|
-
content4.children.map((child) => unwrapBlockContent(child))
|
|
50480
|
-
)
|
|
50395
|
+
children: content4.children.map((child) => unwrapBlockContent(child)).flat()
|
|
50481
50396
|
}
|
|
50482
50397
|
]
|
|
50483
50398
|
};
|
|
@@ -50541,9 +50456,7 @@ var remarkToSlate = (root2, field, imageCallback, raw, skipMDXProcess) => {
|
|
|
50541
50456
|
case "paragraph":
|
|
50542
50457
|
return {
|
|
50543
50458
|
type: "lic",
|
|
50544
|
-
children: (
|
|
50545
|
-
child.children.map((child2) => phrasingContent(child2))
|
|
50546
|
-
)
|
|
50459
|
+
children: child.children.map((child2) => phrasingContent(child2)).flat()
|
|
50547
50460
|
};
|
|
50548
50461
|
case "blockquote": {
|
|
50549
50462
|
return {
|
|
@@ -50606,7 +50519,7 @@ var remarkToSlate = (root2, field, imageCallback, raw, skipMDXProcess) => {
|
|
|
50606
50519
|
const unwrapBlockContent = (content4) => {
|
|
50607
50520
|
const flattenPhrasingContent = (children) => {
|
|
50608
50521
|
const children2 = children.map((child) => phrasingContent(child));
|
|
50609
|
-
return (
|
|
50522
|
+
return (Array.isArray(children2) ? children2 : [children2]).flat();
|
|
50610
50523
|
};
|
|
50611
50524
|
switch (content4.type) {
|
|
50612
50525
|
case "heading":
|
|
@@ -50656,15 +50569,13 @@ var remarkToSlate = (root2, field, imageCallback, raw, skipMDXProcess) => {
|
|
|
50656
50569
|
type: "a",
|
|
50657
50570
|
url: sanitizeUrl(content4.url),
|
|
50658
50571
|
title: content4.title,
|
|
50659
|
-
children: (
|
|
50660
|
-
content4.children.map((child) => staticPhrasingContent(child))
|
|
50661
|
-
)
|
|
50572
|
+
children: content4.children.map((child) => staticPhrasingContent(child)).flat()
|
|
50662
50573
|
};
|
|
50663
50574
|
};
|
|
50664
50575
|
const heading2 = (content4) => {
|
|
50665
50576
|
return {
|
|
50666
50577
|
type: ["h1", "h2", "h3", "h4", "h5", "h6"][content4.depth - 1],
|
|
50667
|
-
children:
|
|
50578
|
+
children: content4.children.map(phrasingContent).flat()
|
|
50668
50579
|
};
|
|
50669
50580
|
};
|
|
50670
50581
|
const staticPhrasingContent = (content4) => {
|
|
@@ -50737,11 +50648,7 @@ var remarkToSlate = (root2, field, imageCallback, raw, skipMDXProcess) => {
|
|
|
50737
50648
|
const accum = [];
|
|
50738
50649
|
switch (node2.type) {
|
|
50739
50650
|
case "emphasis": {
|
|
50740
|
-
const children = (
|
|
50741
|
-
node2.children.map(
|
|
50742
|
-
(child) => phrashingMark(child, [...marks, "italic"])
|
|
50743
|
-
)
|
|
50744
|
-
);
|
|
50651
|
+
const children = node2.children.map((child) => phrashingMark(child, [...marks, "italic"])).flat();
|
|
50745
50652
|
children.forEach((child) => {
|
|
50746
50653
|
accum.push(child);
|
|
50747
50654
|
});
|
|
@@ -50759,20 +50666,14 @@ var remarkToSlate = (root2, field, imageCallback, raw, skipMDXProcess) => {
|
|
|
50759
50666
|
break;
|
|
50760
50667
|
}
|
|
50761
50668
|
case "delete": {
|
|
50762
|
-
const children = (
|
|
50763
|
-
node2.children.map(
|
|
50764
|
-
(child) => phrashingMark(child, [...marks, "strikethrough"])
|
|
50765
|
-
)
|
|
50766
|
-
);
|
|
50669
|
+
const children = node2.children.map((child) => phrashingMark(child, [...marks, "strikethrough"])).flat();
|
|
50767
50670
|
children.forEach((child) => {
|
|
50768
50671
|
accum.push(child);
|
|
50769
50672
|
});
|
|
50770
50673
|
break;
|
|
50771
50674
|
}
|
|
50772
50675
|
case "strong": {
|
|
50773
|
-
const children = (
|
|
50774
|
-
node2.children.map((child) => phrashingMark(child, [...marks, "bold"]))
|
|
50775
|
-
);
|
|
50676
|
+
const children = node2.children.map((child) => phrashingMark(child, [...marks, "bold"])).flat();
|
|
50776
50677
|
children.forEach((child) => {
|
|
50777
50678
|
accum.push(child);
|
|
50778
50679
|
});
|
|
@@ -50783,9 +50684,7 @@ var remarkToSlate = (root2, field, imageCallback, raw, skipMDXProcess) => {
|
|
|
50783
50684
|
break;
|
|
50784
50685
|
}
|
|
50785
50686
|
case "link": {
|
|
50786
|
-
const children = (
|
|
50787
|
-
node2.children.map((child) => phrashingMark(child, marks))
|
|
50788
|
-
);
|
|
50687
|
+
const children = node2.children.map((child) => phrashingMark(child, marks)).flat();
|
|
50789
50688
|
accum.push({
|
|
50790
50689
|
type: "a",
|
|
50791
50690
|
url: sanitizeUrl(node2.url),
|
|
@@ -50847,7 +50746,7 @@ var remarkToSlate = (root2, field, imageCallback, raw, skipMDXProcess) => {
|
|
|
50847
50746
|
};
|
|
50848
50747
|
};
|
|
50849
50748
|
const paragraph2 = (content4) => {
|
|
50850
|
-
const children =
|
|
50749
|
+
const children = content4.children.map(phrasingContent).flat();
|
|
50851
50750
|
if (children.length === 1) {
|
|
50852
50751
|
if (children[0]) {
|
|
50853
50752
|
if (children[0].type === "html_inline") {
|
|
@@ -50971,7 +50870,7 @@ function parseShortcode(preprocessedString, template) {
|
|
|
50971
50870
|
var mdxToAst = (value) => {
|
|
50972
50871
|
return remark().use(remarkMdx).use(remarkGfm).parse(value);
|
|
50973
50872
|
};
|
|
50974
|
-
var MDX_PARSE_ERROR_MSG = "TinaCMS supports a stricter version of markdown and a subset of MDX. https://tina.io/docs/
|
|
50873
|
+
var MDX_PARSE_ERROR_MSG = "TinaCMS supports a stricter version of markdown and a subset of MDX. https://tina.io/docs/r/what-is-markdown";
|
|
50975
50874
|
var parseMDX = (value, field, imageCallback) => {
|
|
50976
50875
|
if (!value) {
|
|
50977
50876
|
return { type: "root", children: [] };
|
package/dist/parse/index.d.ts
CHANGED
|
@@ -57,8 +57,8 @@ import { RichTextParseError } from './remarkToPlate';
|
|
|
57
57
|
*/
|
|
58
58
|
export declare const markdownToAst: (value: string, field: RichTextType) => import("mdast").Root;
|
|
59
59
|
export declare const mdxToAst: (value: string) => import("mdast").Root;
|
|
60
|
-
export declare const MDX_PARSE_ERROR_MSG = "TinaCMS supports a stricter version of markdown and a subset of MDX. https://tina.io/docs/
|
|
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/
|
|
60
|
+
export declare const MDX_PARSE_ERROR_MSG = "TinaCMS supports a stricter version of markdown and a subset of MDX. https://tina.io/docs/r/what-is-markdown";
|
|
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/r/what-is-markdown\" target=\"_blank\" rel=\"noopener noreferrer\">Learn More</a>";
|
|
62
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;
|
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
*/
|
|
6
|
-
import type * as Md from 'mdast';
|
|
7
|
-
import type * as Plate from './plate';
|
|
8
6
|
import type { RichTextType } from '@tinacms/schema-tools';
|
|
9
|
-
import type
|
|
7
|
+
import type * as Md from 'mdast';
|
|
10
8
|
import type { ContainerDirective } from 'mdast-util-directive';
|
|
9
|
+
import type { MdxJsxFlowElement, MdxJsxTextElement } from 'mdast-util-mdx-jsx';
|
|
10
|
+
import type * as Plate from './plate';
|
|
11
11
|
export type { Position, PositionItem } from './plate';
|
|
12
12
|
declare module 'mdast' {
|
|
13
13
|
interface StaticPhrasingContentMap {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tinacms/mdx",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.2",
|
|
4
4
|
"typings": "dist/index.d.ts",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"browser": "dist/index.browser.mjs",
|
|
@@ -30,7 +30,6 @@
|
|
|
30
30
|
"acorn": "8.8.2",
|
|
31
31
|
"ccount": "2.0.1",
|
|
32
32
|
"estree-util-is-identifier-name": "2.1.0",
|
|
33
|
-
"lodash.flatten": "4.4.0",
|
|
34
33
|
"mdast-util-compact": "4.1.1",
|
|
35
34
|
"mdast-util-directive": "2.2.4",
|
|
36
35
|
"mdast-util-from-markdown": "1.3.0",
|
|
@@ -56,7 +55,7 @@
|
|
|
56
55
|
"unist-util-visit": "4.1.2",
|
|
57
56
|
"uvu": "0.5.6",
|
|
58
57
|
"vfile-message": "3.1.4",
|
|
59
|
-
"@tinacms/schema-tools": "1.
|
|
58
|
+
"@tinacms/schema-tools": "1.10.0"
|
|
60
59
|
},
|
|
61
60
|
"publishConfig": {
|
|
62
61
|
"registry": "https://registry.npmjs.org"
|
|
@@ -67,7 +66,6 @@
|
|
|
67
66
|
},
|
|
68
67
|
"devDependencies": {
|
|
69
68
|
"@types/estree": "1.0.0",
|
|
70
|
-
"@types/lodash.flatten": "^4.4.9",
|
|
71
69
|
"@types/mdast": "^3.0.15",
|
|
72
70
|
"@types/node": "^22.13.1",
|
|
73
71
|
"@types/prettier": "^2.7.3",
|
|
@@ -80,7 +78,7 @@
|
|
|
80
78
|
"typescript": "^5.7.3",
|
|
81
79
|
"vite": "^4.5.9",
|
|
82
80
|
"vitest": "^0.32.4",
|
|
83
|
-
"@tinacms/scripts": "1.4.
|
|
81
|
+
"@tinacms/scripts": "1.4.1"
|
|
84
82
|
},
|
|
85
83
|
"scripts": {
|
|
86
84
|
"types": "tsc",
|