@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 descriptionFragments = node.children.flatMap((child) => {
142
- var _a;
143
- if (child.type === 'text') {
144
- return [child.value];
141
+ const extractTextFromNode = (node) => {
142
+ if (node.type === 'text') {
143
+ return [node.value.replace(/\s+/g, ' ').trim()];
145
144
  }
146
- else if (child.type === 'element' &&
147
- child.tagName === 'p' &&
148
- ((_a = child.children[0]) === null || _a === void 0 ? void 0 : _a.type) === 'text') {
149
- return [child.children[0].value];
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
- return descriptionFragments.length > 0 ? descriptionFragments.join('\n') : undefined;
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