@mintlify/common 1.0.441 → 1.0.443
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.
|
@@ -23,6 +23,7 @@ export const rehypeMdxExtractExamples = (mdxExtracts) => {
|
|
|
23
23
|
request = request !== null && request !== void 0 ? request : {
|
|
24
24
|
type: node.name,
|
|
25
25
|
children: parseChildren(node),
|
|
26
|
+
attributes: getAttributes(node),
|
|
26
27
|
};
|
|
27
28
|
if (parent && i != null)
|
|
28
29
|
parent.children.splice(i, 1);
|
|
@@ -31,6 +32,7 @@ export const rehypeMdxExtractExamples = (mdxExtracts) => {
|
|
|
31
32
|
response = response !== null && response !== void 0 ? response : {
|
|
32
33
|
type: node.name,
|
|
33
34
|
children: parseChildren(node),
|
|
35
|
+
attributes: getAttributes(node),
|
|
34
36
|
};
|
|
35
37
|
if (parent && i != null)
|
|
36
38
|
parent.children.splice(i, 1);
|
|
@@ -43,6 +45,21 @@ export const rehypeMdxExtractExamples = (mdxExtracts) => {
|
|
|
43
45
|
return tree;
|
|
44
46
|
};
|
|
45
47
|
};
|
|
48
|
+
const getAttributes = (node) => {
|
|
49
|
+
return node.attributes
|
|
50
|
+
.map((attr) => {
|
|
51
|
+
var _a;
|
|
52
|
+
if (attr.type === 'mdxJsxAttribute') {
|
|
53
|
+
return {
|
|
54
|
+
type: attr.type,
|
|
55
|
+
name: attr.name,
|
|
56
|
+
value: typeof attr.value === 'string' ? attr.value : JSON.stringify((_a = attr.value) !== null && _a !== void 0 ? _a : ''),
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
return undefined;
|
|
60
|
+
})
|
|
61
|
+
.filter(Boolean);
|
|
62
|
+
};
|
|
46
63
|
const parseChildren = (node) => {
|
|
47
64
|
return node.children.filter(isMdxJsxFlowElementHast).flatMap((child) => {
|
|
48
65
|
var _a;
|