@mintlify/common 1.0.357 → 1.0.359
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.
|
@@ -138,19 +138,23 @@ export const parseField = (node) => {
|
|
|
138
138
|
return Object.assign({ locationAttr }, schemaInfo);
|
|
139
139
|
};
|
|
140
140
|
export const parseDescription = (node) => {
|
|
141
|
-
const
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
return [child.value];
|
|
141
|
+
const extractTextFromNode = (node) => {
|
|
142
|
+
if (node.type === 'text') {
|
|
143
|
+
return [node.value.replace(/\s+/g, ' ').trim()];
|
|
145
144
|
}
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
145
|
+
if (node.type === 'element') {
|
|
146
|
+
if (node.tagName === 'code') {
|
|
147
|
+
const codeContent = node.children.map(extractTextFromNode).flat().join('');
|
|
148
|
+
return [`\`${codeContent}\``];
|
|
149
|
+
}
|
|
150
|
+
return node.children.flatMap(extractTextFromNode);
|
|
150
151
|
}
|
|
151
152
|
return [];
|
|
152
|
-
}
|
|
153
|
-
|
|
153
|
+
};
|
|
154
|
+
const descriptionFragments = node.children.flatMap(extractTextFromNode);
|
|
155
|
+
return descriptionFragments.length > 0
|
|
156
|
+
? descriptionFragments.join(' ').replace(/\s+/g, ' ').trim()
|
|
157
|
+
: undefined;
|
|
154
158
|
};
|
|
155
159
|
const typeStringToSchemaType = {
|
|
156
160
|
// string
|