@tinacms/mdx 2.1.3 → 2.1.5
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.js +31 -8
- package/dist/index.js +31 -8
- package/dist/next/tests/markdown-basic-escapes/field.d.ts +2 -0
- package/dist/next/tests/markdown-basic-escapes/index.test.d.ts +1 -0
- package/dist/next/tests/markdown-basic-tables-escapes/field.d.ts +2 -0
- package/dist/next/tests/markdown-basic-tables-escapes/index.test.d.ts +1 -0
- package/dist/next/tests/markdown-basic-unicode/field.d.ts +2 -0
- package/dist/next/tests/markdown-basic-unicode/index.test.d.ts +1 -0
- package/dist/next/tests/mdx-jsx-conditional-expression-attribute/field.d.ts +2 -0
- package/dist/next/tests/mdx-jsx-conditional-expression-attribute/index.test.d.ts +1 -0
- package/dist/next/tests/mdx-jsx-empty-expression/field.d.ts +2 -0
- package/dist/next/tests/mdx-jsx-empty-expression/index.test.d.ts +1 -0
- package/dist/next/tests/mdx-jsx-in-blockquote/field.d.ts +2 -0
- package/dist/next/tests/mdx-jsx-in-blockquote/index.test.d.ts +1 -0
- package/dist/next/tests/mdx-jsx-template-literal-attribute/field.d.ts +2 -0
- package/dist/next/tests/mdx-jsx-template-literal-attribute/index.test.d.ts +1 -0
- package/dist/next/tests/mdx-jsx-unary-expression-attribute/field.d.ts +2 -0
- package/dist/next/tests/mdx-jsx-unary-expression-attribute/index.test.d.ts +1 -0
- package/dist/repro-large-file.test.d.ts +1 -0
- package/package.json +3 -3
package/dist/index.browser.js
CHANGED
|
@@ -26368,6 +26368,9 @@ var hoistAllTemplates = (field, templates = []) => {
|
|
|
26368
26368
|
// src/next/stringify/to-markdown.ts
|
|
26369
26369
|
var toTinaMarkdown = (tree, field) => {
|
|
26370
26370
|
const patterns = getFieldPatterns(field);
|
|
26371
|
+
const hasJsxTemplates = (field.templates ?? []).some(
|
|
26372
|
+
(t) => typeof t !== "string" && !t.match
|
|
26373
|
+
);
|
|
26371
26374
|
const handlers = {};
|
|
26372
26375
|
handlers["text"] = (node2, parent, context, safeOptions) => {
|
|
26373
26376
|
context.unsafe = context.unsafe.filter((unsafeItem) => {
|
|
@@ -26380,7 +26383,7 @@ var toTinaMarkdown = (tree, field) => {
|
|
|
26380
26383
|
if (field.parser.skipEscaping === "all") {
|
|
26381
26384
|
return node2.value;
|
|
26382
26385
|
}
|
|
26383
|
-
if (field.parser.skipEscaping === "html") {
|
|
26386
|
+
if (field.parser.skipEscaping === "html" || hasJsxTemplates) {
|
|
26384
26387
|
context.unsafe = context.unsafe.filter((unsafeItem) => {
|
|
26385
26388
|
if (unsafeItem.character === "<") {
|
|
26386
26389
|
return false;
|
|
@@ -41311,7 +41314,10 @@ var markAttributes = (content3) => {
|
|
|
41311
41314
|
{
|
|
41312
41315
|
type: "mdxJsxAttribute",
|
|
41313
41316
|
name: "style",
|
|
41314
|
-
value:
|
|
41317
|
+
value: {
|
|
41318
|
+
type: "mdxJsxAttributeValueExpression",
|
|
41319
|
+
value: `{ backgroundColor: "${content3.highlightColor}" }`
|
|
41320
|
+
}
|
|
41315
41321
|
}
|
|
41316
41322
|
];
|
|
41317
41323
|
};
|
|
@@ -42153,7 +42159,10 @@ var markAttributes2 = (content3) => {
|
|
|
42153
42159
|
{
|
|
42154
42160
|
type: "mdxJsxAttribute",
|
|
42155
42161
|
name: "style",
|
|
42156
|
-
value:
|
|
42162
|
+
value: {
|
|
42163
|
+
type: "mdxJsxAttributeValueExpression",
|
|
42164
|
+
value: `{ backgroundColor: "${content3.highlightColor}" }`
|
|
42165
|
+
}
|
|
42157
42166
|
}
|
|
42158
42167
|
];
|
|
42159
42168
|
};
|
|
@@ -48718,13 +48727,27 @@ var getHighlightColorFromAttributes = (attributes2 = []) => {
|
|
|
48718
48727
|
const styleAttribute = attributes2.find(
|
|
48719
48728
|
(attribute) => attribute.type === "mdxJsxAttribute" && attribute.name === "style"
|
|
48720
48729
|
);
|
|
48721
|
-
if (!styleAttribute
|
|
48730
|
+
if (!styleAttribute) {
|
|
48722
48731
|
return void 0;
|
|
48723
48732
|
}
|
|
48724
|
-
|
|
48725
|
-
|
|
48726
|
-
|
|
48727
|
-
|
|
48733
|
+
if (typeof styleAttribute.value === "string") {
|
|
48734
|
+
const backgroundColorMatch = /background-color:\s*([^;]+)/i.exec(
|
|
48735
|
+
styleAttribute.value
|
|
48736
|
+
);
|
|
48737
|
+
return backgroundColorMatch?.[1]?.trim();
|
|
48738
|
+
}
|
|
48739
|
+
if (styleAttribute.value && typeof styleAttribute.value === "object" && styleAttribute.value.type === "mdxJsxAttributeValueExpression") {
|
|
48740
|
+
const expression = styleAttribute.value.value;
|
|
48741
|
+
const camelMatch = /['"]?backgroundColor['"]?\s*:\s*['"]?([^'",}\s]+)['"]?/.exec(expression);
|
|
48742
|
+
if (camelMatch?.[1]) {
|
|
48743
|
+
return camelMatch[1].trim();
|
|
48744
|
+
}
|
|
48745
|
+
const kebabMatch = /['"]?background-color['"]?\s*:\s*['"]?([^'",}\s]+)['"]?/.exec(
|
|
48746
|
+
expression
|
|
48747
|
+
);
|
|
48748
|
+
return kebabMatch?.[1]?.trim();
|
|
48749
|
+
}
|
|
48750
|
+
return void 0;
|
|
48728
48751
|
};
|
|
48729
48752
|
var parseMarkMdxText = (content3, extraMarks = {}, parseChild) => {
|
|
48730
48753
|
if (content3.name !== "mark") {
|
package/dist/index.js
CHANGED
|
@@ -28234,6 +28234,9 @@ var hoistAllTemplates = (field, templates = []) => {
|
|
|
28234
28234
|
// src/next/stringify/to-markdown.ts
|
|
28235
28235
|
var toTinaMarkdown = (tree, field) => {
|
|
28236
28236
|
const patterns = getFieldPatterns(field);
|
|
28237
|
+
const hasJsxTemplates = (field.templates ?? []).some(
|
|
28238
|
+
(t) => typeof t !== "string" && !t.match
|
|
28239
|
+
);
|
|
28237
28240
|
const handlers = {};
|
|
28238
28241
|
handlers["text"] = (node2, parent, context, safeOptions) => {
|
|
28239
28242
|
context.unsafe = context.unsafe.filter((unsafeItem) => {
|
|
@@ -28246,7 +28249,7 @@ var toTinaMarkdown = (tree, field) => {
|
|
|
28246
28249
|
if (field.parser.skipEscaping === "all") {
|
|
28247
28250
|
return node2.value;
|
|
28248
28251
|
}
|
|
28249
|
-
if (field.parser.skipEscaping === "html") {
|
|
28252
|
+
if (field.parser.skipEscaping === "html" || hasJsxTemplates) {
|
|
28250
28253
|
context.unsafe = context.unsafe.filter((unsafeItem) => {
|
|
28251
28254
|
if (unsafeItem.character === "<") {
|
|
28252
28255
|
return false;
|
|
@@ -43177,7 +43180,10 @@ var markAttributes = (content3) => {
|
|
|
43177
43180
|
{
|
|
43178
43181
|
type: "mdxJsxAttribute",
|
|
43179
43182
|
name: "style",
|
|
43180
|
-
value:
|
|
43183
|
+
value: {
|
|
43184
|
+
type: "mdxJsxAttributeValueExpression",
|
|
43185
|
+
value: `{ backgroundColor: "${content3.highlightColor}" }`
|
|
43186
|
+
}
|
|
43181
43187
|
}
|
|
43182
43188
|
];
|
|
43183
43189
|
};
|
|
@@ -44019,7 +44025,10 @@ var markAttributes2 = (content3) => {
|
|
|
44019
44025
|
{
|
|
44020
44026
|
type: "mdxJsxAttribute",
|
|
44021
44027
|
name: "style",
|
|
44022
|
-
value:
|
|
44028
|
+
value: {
|
|
44029
|
+
type: "mdxJsxAttributeValueExpression",
|
|
44030
|
+
value: `{ backgroundColor: "${content3.highlightColor}" }`
|
|
44031
|
+
}
|
|
44023
44032
|
}
|
|
44024
44033
|
];
|
|
44025
44034
|
};
|
|
@@ -50584,13 +50593,27 @@ var getHighlightColorFromAttributes = (attributes2 = []) => {
|
|
|
50584
50593
|
const styleAttribute = attributes2.find(
|
|
50585
50594
|
(attribute) => attribute.type === "mdxJsxAttribute" && attribute.name === "style"
|
|
50586
50595
|
);
|
|
50587
|
-
if (!styleAttribute
|
|
50596
|
+
if (!styleAttribute) {
|
|
50588
50597
|
return void 0;
|
|
50589
50598
|
}
|
|
50590
|
-
|
|
50591
|
-
|
|
50592
|
-
|
|
50593
|
-
|
|
50599
|
+
if (typeof styleAttribute.value === "string") {
|
|
50600
|
+
const backgroundColorMatch = /background-color:\s*([^;]+)/i.exec(
|
|
50601
|
+
styleAttribute.value
|
|
50602
|
+
);
|
|
50603
|
+
return backgroundColorMatch?.[1]?.trim();
|
|
50604
|
+
}
|
|
50605
|
+
if (styleAttribute.value && typeof styleAttribute.value === "object" && styleAttribute.value.type === "mdxJsxAttributeValueExpression") {
|
|
50606
|
+
const expression = styleAttribute.value.value;
|
|
50607
|
+
const camelMatch = /['"]?backgroundColor['"]?\s*:\s*['"]?([^'",}\s]+)['"]?/.exec(expression);
|
|
50608
|
+
if (camelMatch?.[1]) {
|
|
50609
|
+
return camelMatch[1].trim();
|
|
50610
|
+
}
|
|
50611
|
+
const kebabMatch = /['"]?background-color['"]?\s*:\s*['"]?([^'",}\s]+)['"]?/.exec(
|
|
50612
|
+
expression
|
|
50613
|
+
);
|
|
50614
|
+
return kebabMatch?.[1]?.trim();
|
|
50615
|
+
}
|
|
50616
|
+
return void 0;
|
|
50594
50617
|
};
|
|
50595
50618
|
var parseMarkMdxText = (content3, extraMarks = {}, parseChild) => {
|
|
50596
50619
|
if (content3.name !== "mark") {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tinacms/mdx",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.5",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"unist-util-visit": "4.1.2",
|
|
56
56
|
"uvu": "0.5.6",
|
|
57
57
|
"vfile-message": "3.1.4",
|
|
58
|
-
"@tinacms/schema-tools": "2.
|
|
58
|
+
"@tinacms/schema-tools": "2.8.0"
|
|
59
59
|
},
|
|
60
60
|
"publishConfig": {
|
|
61
61
|
"registry": "https://registry.npmjs.org"
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
"typescript": "^5.7.3",
|
|
79
79
|
"vite": "^4.5.9",
|
|
80
80
|
"vitest": "^0.32.4",
|
|
81
|
-
"@tinacms/scripts": "1.6.
|
|
81
|
+
"@tinacms/scripts": "1.6.1"
|
|
82
82
|
},
|
|
83
83
|
"scripts": {
|
|
84
84
|
"types": "tsc",
|