117
(_, content) => `> ${content.trim()}`
118
);
119
120
+ // Remove Cards wrapper before processing individual Card tags
121
+ // (prevents <Cards> from being matched by <Card regex since <Cards starts with <Card)
122
+ result = result.replace(/<\/?Cards[^>]*>/g, '');
123
+
124
// Convert Card - handle multiline and various attribute orders
125
// Self-closing Cards with description attribute
126
result = result.replace(
123
- /<Card[\s\S]*?title="([^"]*)"[\s\S]*?href="([^"]*)"[\s\S]*?description="([^"]*)"[\s\S]*?\/>/g,
127
+ /<Card\b[\s\S]*?title="([^"]*)"[\s\S]*?href="([^"]*)"[\s\S]*?description="([^"]*)"[\s\S]*?\/>/g,
128
'- [$1]($2): $3'
129
);
130
// Cards with children content (non-self-closing)
131
result = result.replace(
128
- /<Card[\s\S]*?title="([^"]*)"[\s\S]*?href="([^"]*)"[\s\S]*?>([\s\S]*?)<\/Card>/g,
132
+ /<Card\b[\s\S]*?title="([^"]*)"[\s\S]*?href="([^"]*)"[\s\S]*?>([\s\S]*?)<\/Card>/g,
133
'- [$1]($2): $3'
134
);
135
// Cards with href before title
136
result = result.replace(
133
- /<Card[\s\S]*?href="([^"]*)"[\s\S]*?title="([^"]*)"[\s\S]*?>([\s\S]*?)<\/Card>/g,
137
+ /<Card\b[\s\S]*?href="([^"]*)"[\s\S]*?title="([^"]*)"[\s\S]*?>([\s\S]*?)<\/Card>/g,
138
'- [$2]($1): $3'
139
);
136
-
140
// Convert ProviderCard to markdown link
141
result = result.replace(
142
/<ProviderCard[\s\S]*?name="([^"]*)"[\s\S]*?href="([^"]*)"[\s\S]*?languages=\{\[([^\]]*)\]\}[\s\S]*?\/>/g,
143
(_, name, href, langs) => `- [${name}](${href}) (${langs.replace(/"/g, '')})`
144
);
145
146
+ // Strip orphaned indentation from converted list items
147
+ // (Cards/ProviderCards nested inside wrapper components had JSX indentation that persists after wrapper removal)
148
+ result = result.replace(/^[ \t]+(- \[)/gm, '$1');
149
+
150
// Convert Tabs/Tab content - keep inner content
151
result = result.replace(/<TabsList>[\s\S]*?<\/TabsList>/g, '');
152
result = result.replace(/<TabsTrigger[^>]*>[^<]*<\/TabsTrigger>/g, '');
246
'- [llms-full.txt](/llms-full.txt) — Complete documentation in one file'
247
);
248
242
- // Remove wrapper components (Cards, ProviderGrid, Tabs, Frame, div, QuickstartFlow, IntegrationTabs, Accordions, ToolTypeFlow, ToolkitsLanding, TemplateGrid, etc.)
243
- result = result.replace(/<\/?(Cards|ProviderGrid|Tabs|Frame|div|QuickstartFlow|IntegrationTabs|Accordions|ToolTypeFlow|ToolkitsLanding|TemplateGrid)[^>]*>/g, '');
249
+ // Remove wrapper components (ProviderGrid, Tabs, Frame, div, QuickstartFlow, IntegrationTabs, Accordions, ToolTypeFlow, ToolkitsLanding, TemplateGrid, etc.)
250
+ // Note: Cards wrapper is removed earlier (before Card conversion) to prevent regex conflicts
251
+ result = result.replace(/<\/?(ProviderGrid|Tabs|Frame|div|QuickstartFlow|IntegrationTabs|Accordions|ToolTypeFlow|ToolkitsLanding|TemplateGrid)[^>]*>/g, '');
252
253
// Remove remaining self-closing JSX tags (including those with JSX expressions)
254
result = result.replace(/<[A-Z][a-zA-Z]*[\s\S]*?\/>/g, '');