Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
Mirrored from https://github.com/Camo67/composio.git
Synced Nov 22, 03:15 UTC
fix: use type cleanup instead of <code> tags for MDX table compatibility
<code> HTML tags don't work inside MDX table cells either. Instead, strip <ArrayBufferLike> in cleanupGenericTypes() and use backtick code spans with brace-only escaping. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sushmitha Mallesh committed
Mar 10, 2026 at 21:52 UTC
be8cdf6592abadf6a22a686306a0d0b970d6e832
3 files changed
+23
-26
docs/content/reference/sdk-reference/typescript/remote-file.mdx
+1
-1
@@ -47,7 +47,7 @@ async buffer(): Promise<Uint8Array<ArrayBufferLike>>
47
48
**Returns**
49
50
-<code>Promise<Uint8Array<ArrayBufferLike>></code> — The file content as a Uint8Array
50
+`Promise<Uint8Array>` — The file content as a Uint8Array
51
52
---
53
docs/content/reference/sdk-reference/typescript/tool-router-session-files-mount.mdx
+1
-1
@@ -144,7 +144,7 @@ async upload(input: string | File | ArrayBuffer | Uint8Array<ArrayBufferLike>, o
144
145
| Name | Type | Description |
146
|------|------|-------------|
147
-| `input` | <code>string | File | ArrayBuffer | Uint8Array<ArrayBufferLike></code> | File path (string), native File, or raw buffer (ArrayBuffer | Uint8Array). |
147
+| `input` | `string \| File \| ArrayBuffer \| Uint8Array` | File path (string), native File, or raw buffer (ArrayBuffer \| Uint8Array). |
148
| `options?` | `object` | Optional configuration. When passing a buffer, remotePath is required. |
149
150
**Returns**
ts/packages/core/scripts/generate-docs.ts
+21
-24
@@ -454,8 +454,8 @@ function generateMethodMdx(method: MethodDoc): string {
454
for (const param of sig.parameters) {
455
const opt = param.required ? '' : '?';
456
const desc = escapeTextForMdx(param.description || '');
457
- const typeCell = safeInlineType(simplifyTypeForTable(param.type));
458
- lines.push(`| \`${param.name}${opt}\` | ${typeCell} | ${desc} |`);
457
+ const typeCell = escapeTypeForMdx(simplifyTypeForTable(param.type));
458
+ lines.push(`| \`${param.name}${opt}\` | \`${typeCell}\` | ${desc} |`);
459
}
460
} else {
461
// No descriptions - use simpler table
@@ -463,8 +463,8 @@ function generateMethodMdx(method: MethodDoc): string {
463
lines.push('|------|------|');
464
for (const param of sig.parameters) {
465
const opt = param.required ? '' : '?';
466
- const typeCell = safeInlineType(simplifyTypeForTable(param.type));
467
- lines.push(`| \`${param.name}${opt}\` | ${typeCell} |`);
466
+ const typeCell = escapeTypeForMdx(simplifyTypeForTable(param.type));
467
+ lines.push(`| \`${param.name}${opt}\` | \`${typeCell}\` |`);
468
}
469
}
470
lines.push('');
@@ -474,8 +474,8 @@ function generateMethodMdx(method: MethodDoc): string {
474
if (sig.returnType !== 'void') {
475
lines.push('**Returns**');
476
lines.push('');
477
- const returnTypeDisplay = safeInlineType(simplifyTypeForTable(sig.returnType));
478
- let returnLine = returnTypeDisplay;
477
+ const returnTypeDisplay = escapeTypeForMdx(simplifyTypeForTable(sig.returnType));
478
+ let returnLine = `\`${returnTypeDisplay}\``;
479
if (sig.returnDescription) {
480
returnLine += ` — ${escapeTextForMdx(sig.returnDescription)}`;
481
}
@@ -568,16 +568,16 @@ function generateClassMdx(classDoc: ClassDoc): string {
568
lines.push('| Name | Type | Description |');
569
lines.push('|------|------|-------------|');
570
for (const prop of publicProps) {
571
- const typeCell = safeInlineType(simplifyTypeForTable(prop.type));
571
+ const typeCell = escapeTypeForMdx(simplifyTypeForTable(prop.type));
572
const safeDesc = escapeTextForMdx(prop.description || '');
573
- lines.push(`| \`${prop.name}\` | ${typeCell} | ${safeDesc} |`);
573
+ lines.push(`| \`${prop.name}\` | \`${typeCell}\` | ${safeDesc} |`);
574
}
575
} else {
576
lines.push('| Name | Type |');
577
lines.push('|------|------|');
578
for (const prop of publicProps) {
579
- const typeCell = safeInlineType(simplifyTypeForTable(prop.type));
580
- lines.push(`| \`${prop.name}\` | ${typeCell} |`);
579
+ const typeCell = escapeTypeForMdx(simplifyTypeForTable(prop.type));
580
+ lines.push(`| \`${prop.name}\` | \`${typeCell}\` |`);
581
}
582
}
583
lines.push('');
@@ -612,25 +612,12 @@ function escapeTextForMdx(str: string): string {
612
.replace(/>/g, '>');
613
}
614
615
-// Render a type string as an inline code element safe for MDX tables.
616
-// Uses <code> HTML tag with </> escaping instead of backticks,
617
-// because MDX parsers can interpret <TypeName> as JSX even inside
618
-// backtick code spans within table cells.
619
-function safeInlineType(type: string): string {
620
- const escaped = type
621
- .replace(/&/g, '&')
622
- .replace(/</g, '<')
623
- .replace(/>/g, '>')
624
- .replace(/\{/g, '\\{')
625
- .replace(/\}/g, '\\}');
626
- return `<code>${escaped}</code>`;
627
-}
628
-
615
// Clean up internal generic type parameters that don't add value for users
616
function cleanupGenericTypes(type: string): string {
617
// Remove generic parameters that are just implementation details
618
// e.g., "Tools<unknown, unknown, TProvider>" -> "Tools"
619
// e.g., "Composio<TProvider>" -> "Composio"
620
+ // e.g., "Uint8Array<ArrayBufferLike>" -> "Uint8Array"
621
let cleaned = type;
622
623
// Remove type parameters that are just unknowns or TProvider
@@ -638,12 +625,22 @@ function cleanupGenericTypes(type: string): string {
625
cleaned = cleaned.replace(/<TProvider>/g, '');
626
cleaned = cleaned.replace(/<unknown>/g, '');
627
628
+ // Remove TypeScript internal generic parameters (e.g., <ArrayBufferLike>)
629
+ // that add no value for users and break MDX parsing
630
+ cleaned = cleaned.replace(/<ArrayBufferLike>/g, '');
631
+
632
// Clean up double spaces and trailing commas
633
cleaned = cleaned.replace(/\s+/g, ' ').trim();
634
635
return cleaned;
636
}
637
638
+// Escape type strings for safe use in MDX backtick code spans.
639
+// Escapes curly braces which MDX interprets as JSX expressions.
640
+function escapeTypeForMdx(type: string): string {
641
+ return type.replace(/\{/g, '\\{').replace(/\}/g, '\\}');
642
+}
643
+
644
// Simplify complex types for table display (aggressive)
645
function simplifyTypeForTable(type: string): string {
646
// First clean up internal generics