/** * Converts raw MDX content to clean Markdown suitable for AI agents. * * Strips export/import statements and standalone JSX divs with className * attributes, passing everything else through as valid Markdown. */ export function mdxToCleanMarkdown(raw: string): string { const lines = raw.split("\n"); const out: string[] = []; let inJsxBlock = false; let jsxDepth = 0; for (const line of lines) { const trimmed = line.trim(); if (trimmed.startsWith("export ") || trimmed.startsWith("import ")) { continue; } if ( !inJsxBlock && trimmed.startsWith("