ardo 2.2.0 → 2.2.1

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.
@@ -621,6 +621,9 @@ function copyRecursive(src, dest) {
621
621
  }
622
622
  }
623
623
  function detectGitHubBasename(cwd) {
624
+ if (process.env.NODE_ENV !== "production") {
625
+ return void 0;
626
+ }
624
627
  const repoName = detectGitHubRepoName(cwd || process.cwd());
625
628
  return repoName ? `/${repoName}/` : void 0;
626
629
  }
@@ -1256,4 +1259,4 @@ export {
1256
1259
  getPageDataForRoute,
1257
1260
  generateSidebar2 as generateSidebar
1258
1261
  };
1259
- //# sourceMappingURL=chunk-5NCTTGEC.js.map
1262
+ //# sourceMappingURL=chunk-R6CRXVQK.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/vite/plugin.ts","../src/markdown/shiki.ts","../src/markdown/containers.ts","../src/vite/routes-plugin.ts","../src/runtime/loader.ts","../src/markdown/pipeline.ts","../src/markdown/toc.ts","../src/markdown/links.ts","../src/runtime/sidebar.ts"],"sourcesContent":["import type { Plugin, UserConfig } from \"vite\"\nimport type { PressConfig, ProjectMeta, ResolvedConfig } from \"../config/types\"\nimport type { TypeDocConfig } from \"../typedoc/types\"\nimport { resolveConfig } from \"../config/index\"\nimport { generateApiDocs } from \"../typedoc/generator\"\nimport { reactRouter } from \"@react-router/dev/vite\"\nimport mdx from \"@mdx-js/rollup\"\nimport remarkFrontmatter from \"remark-frontmatter\"\nimport remarkMdxFrontmatter from \"remark-mdx-frontmatter\"\nimport remarkGfm from \"remark-gfm\"\nimport remarkDirective from \"remark-directive\"\nimport rehypeShiki from \"@shikijs/rehype\"\nimport { ardoLineTransformer, remarkCodeMeta } from \"../markdown/shiki\"\nimport { remarkContainersMdx } from \"../markdown/containers\"\nimport fs from \"fs/promises\"\nimport fsSync from \"fs\"\nimport path from \"path\"\nimport { execSync } from \"child_process\"\nimport matter from \"gray-matter\"\nimport { ardoRoutesPlugin, type ArdoRoutesPluginOptions } from \"./routes-plugin\"\n\n/**\n * Finds the package root by looking for package.json in parent directories.\n * Returns the path relative to cwd, or undefined if not found.\n */\nfunction findPackageRoot(cwd: string): string | undefined {\n let dir = path.resolve(cwd)\n const root = path.parse(dir).root\n\n while (dir !== root) {\n const parentDir = path.dirname(dir)\n const packageJsonPath = path.join(parentDir, \"package.json\")\n\n if (fsSync.existsSync(packageJsonPath)) {\n // Return relative path from cwd to parent\n return path.relative(cwd, parentDir) || \".\"\n }\n\n dir = parentDir\n }\n\n return undefined\n}\n\n/**\n * Detects the GitHub repository name from git remote URL.\n * Returns the repo name (e.g., 'ardo' from 'github.com/sebastian-software/ardo')\n * or undefined if not a GitHub repo.\n */\nfunction detectGitHubRepoName(cwd: string): string | undefined {\n try {\n const remoteUrl = execSync(\"git remote get-url origin\", {\n cwd,\n encoding: \"utf-8\",\n stdio: [\"pipe\", \"pipe\", \"pipe\"],\n }).trim()\n\n // Parse GitHub URL (supports both HTTPS and SSH)\n // https://github.com/user/repo.git\n // git@github.com:user/repo.git\n const match = remoteUrl.match(/github\\.com[/:][\\w-]+\\/([\\w.-]+?)(?:\\.git)?$/)\n return match?.[1]\n } catch {\n return undefined\n }\n}\n\n/**\n * Reads project metadata from the nearest package.json.\n */\nfunction readProjectMeta(root: string): ProjectMeta {\n const pkgPath = path.join(root, \"package.json\")\n try {\n const raw = fsSync.readFileSync(pkgPath, \"utf-8\")\n const pkg = JSON.parse(raw)\n\n let repository: string | undefined\n if (typeof pkg.repository === \"string\") {\n repository = pkg.repository\n } else if (pkg.repository?.url) {\n // Normalize git+https://... or git://... URLs\n repository = pkg.repository.url\n .replace(/^git\\+/, \"\")\n .replace(/^git:\\/\\//, \"https://\")\n .replace(/\\.git$/, \"\")\n }\n\n let author: string | undefined\n if (typeof pkg.author === \"string\") {\n author = pkg.author\n } else if (pkg.author?.name) {\n author = pkg.author.name\n }\n\n return {\n name: pkg.name,\n homepage: pkg.homepage,\n repository,\n version: pkg.version,\n author,\n license: pkg.license,\n }\n } catch {\n return {}\n }\n}\n\n/**\n * Recursively copies files from src to dest, overwriting existing files.\n */\nfunction copyRecursive(src: string, dest: string) {\n const stat = fsSync.statSync(src)\n\n if (stat.isDirectory()) {\n if (!fsSync.existsSync(dest)) {\n fsSync.mkdirSync(dest, { recursive: true })\n }\n for (const item of fsSync.readdirSync(src)) {\n copyRecursive(path.join(src, item), path.join(dest, item))\n }\n } else {\n fsSync.copyFileSync(src, dest)\n }\n}\n\n/**\n * Detects the GitHub Pages basename from the git remote URL.\n * Returns `\"/repo-name/\"` if a GitHub repo is detected, otherwise `undefined`.\n *\n * Use this in `react-router.config.ts` to synchronize client-side routing\n * with the Vite `base` path that Ardo auto-detects:\n *\n * ```ts\n * import { detectGitHubBasename } from \"ardo/vite\"\n *\n * export default {\n * ssr: false,\n * prerender: true,\n * basename: detectGitHubBasename(),\n * } satisfies Config\n * ```\n */\nexport function detectGitHubBasename(cwd?: string): string | undefined {\n if (process.env.NODE_ENV !== \"production\") {\n return undefined\n }\n const repoName = detectGitHubRepoName(cwd || process.cwd())\n return repoName ? `/${repoName}/` : undefined\n}\n\nconst VIRTUAL_MODULE_ID = \"virtual:ardo/config\"\nconst RESOLVED_VIRTUAL_MODULE_ID = \"\\0\" + VIRTUAL_MODULE_ID\n\nconst VIRTUAL_SIDEBAR_ID = \"virtual:ardo/sidebar\"\nconst RESOLVED_VIRTUAL_SIDEBAR_ID = \"\\0\" + VIRTUAL_SIDEBAR_ID\n\nconst VIRTUAL_SEARCH_ID = \"virtual:ardo/search-index\"\nconst RESOLVED_VIRTUAL_SEARCH_ID = \"\\0\" + VIRTUAL_SEARCH_ID\n\n// Module-level flags to prevent duplicate operations across plugin instances\n// This is necessary because React Router creates multiple Vite instances\nlet typedocGenerated = false\nlet flattenExecuted = false\n\nexport interface ArdoPluginOptions extends Partial<PressConfig> {\n /** Options for the routes generator plugin */\n routes?: ArdoRoutesPluginOptions | false\n /**\n * Auto-detect GitHub repository and set base path for GitHub Pages.\n * When true, automatically sets `base: '/repo-name/'` if deploying to GitHub Pages.\n * @default true\n */\n githubPages?: boolean\n /**\n * Directory where routes are located.\n * @default \"./app/routes\"\n */\n routesDir?: string\n}\n\nexport function ardoPlugin(options: ArdoPluginOptions = {}): Plugin[] {\n let resolvedConfig: ResolvedConfig\n let routesDir: string\n\n // Extract ardo-specific options from the rest (which is PressConfig)\n const {\n routes,\n typedoc,\n githubPages = true,\n routesDir: routesDirOption,\n ...pressConfig\n } = options\n\n const mainPlugin: Plugin = {\n name: \"ardo\",\n enforce: \"pre\",\n\n config(userConfig, env): UserConfig {\n const root = userConfig.root || process.cwd()\n routesDir = routesDirOption || path.join(root, \"app\", \"routes\")\n\n const result: UserConfig = {\n optimizeDeps: {\n exclude: [\"ardo/ui/styles.css\"],\n },\n ssr: {\n noExternal: [\"ardo\"],\n },\n }\n\n // Auto-detect GitHub Pages base path for production builds\n if (githubPages && env.command === \"build\" && !userConfig.base) {\n const repoName = detectGitHubRepoName(root)\n if (repoName) {\n result.base = `/${repoName}/`\n console.log(`[ardo] GitHub Pages detected, using base: ${result.base}`)\n }\n }\n\n return result\n },\n\n async configResolved(config) {\n const root = config.root\n routesDir = routesDirOption || path.join(root, \"app\", \"routes\")\n\n // Auto-detect project metadata from package.json\n const detectedProject = readProjectMeta(root)\n const project: ProjectMeta = { ...detectedProject, ...pressConfig.project }\n\n const defaultConfig: PressConfig = {\n title: pressConfig.title ?? \"Ardo\",\n description: pressConfig.description ?? \"Documentation powered by Ardo\",\n }\n\n // For React Router, contentDir is the routes directory\n const configWithRoutes = {\n ...defaultConfig,\n ...pressConfig,\n project,\n srcDir: routesDir,\n }\n\n resolvedConfig = resolveConfig(configWithRoutes, root)\n },\n\n resolveId(id) {\n if (id === VIRTUAL_MODULE_ID) {\n return RESOLVED_VIRTUAL_MODULE_ID\n }\n if (id === VIRTUAL_SIDEBAR_ID) {\n return RESOLVED_VIRTUAL_SIDEBAR_ID\n }\n if (id === VIRTUAL_SEARCH_ID) {\n return RESOLVED_VIRTUAL_SEARCH_ID\n }\n },\n\n async load(id) {\n if (id === RESOLVED_VIRTUAL_MODULE_ID) {\n const clientConfig = {\n title: resolvedConfig.title,\n description: resolvedConfig.description,\n base: resolvedConfig.base,\n lang: resolvedConfig.lang,\n themeConfig: resolvedConfig.themeConfig,\n project: resolvedConfig.project,\n }\n return `export default ${JSON.stringify(clientConfig)}`\n }\n\n if (id === RESOLVED_VIRTUAL_SIDEBAR_ID) {\n const sidebar = await generateSidebar(resolvedConfig, routesDir)\n return `export default ${JSON.stringify(sidebar)}`\n }\n\n if (id === RESOLVED_VIRTUAL_SEARCH_ID) {\n const searchIndex = await generateSearchIndex(routesDir)\n return `export default ${JSON.stringify(searchIndex)}`\n }\n },\n }\n\n const plugins: Plugin[] = [mainPlugin]\n\n // Add routes plugin unless explicitly disabled\n if (routes !== false) {\n plugins.push(\n ardoRoutesPlugin({\n routesDir: routesDirOption,\n ...routes,\n })\n )\n }\n\n // Add TypeDoc plugin if enabled\n if (typedoc) {\n // Find package root to use as default entry point and tsconfig base\n const packageRoot = findPackageRoot(process.cwd())\n const defaultEntryPoint = packageRoot ? `${packageRoot}/src/index.ts` : \"./src/index.ts\"\n const defaultTsconfig = packageRoot ? `${packageRoot}/tsconfig.json` : \"./tsconfig.json\"\n\n const defaultTypedocConfig: TypeDocConfig = {\n enabled: true,\n entryPoints: [defaultEntryPoint],\n tsconfig: defaultTsconfig,\n out: \"api-reference\",\n excludePrivate: true,\n excludeInternal: true,\n }\n\n const typedocConfig: TypeDocConfig =\n typedoc === true ? defaultTypedocConfig : { ...defaultTypedocConfig, ...typedoc }\n\n const typedocPlugin: Plugin = {\n name: \"ardo:typedoc\",\n\n async buildStart() {\n // Use module-level flag to prevent duplicate generation across plugin instances\n if (typedocGenerated || !typedocConfig.enabled) {\n return\n }\n\n console.log(\"[ardo] Generating API documentation with TypeDoc...\")\n const startTime = Date.now()\n try {\n const outputDir = routesDirOption || \"./app/routes\"\n const docs = await generateApiDocs(typedocConfig, outputDir)\n const duration = Date.now() - startTime\n console.log(`[ardo] Generated ${docs.length} API documentation pages in ${duration}ms`)\n } catch (error) {\n console.warn(\"[ardo] TypeDoc generation failed. API documentation will not be available.\")\n console.warn(\"[ardo] Check your typedoc.entryPoints configuration.\")\n if (error instanceof Error) {\n console.warn(`[ardo] Error: ${error.message}`)\n }\n }\n typedocGenerated = true\n },\n }\n\n plugins.unshift(typedocPlugin)\n }\n\n // Add MDX plugin with Ardo's markdown pipeline\n const themeConfig = pressConfig.markdown?.theme\n const hasThemeObject = themeConfig && typeof themeConfig === \"object\" && \"light\" in themeConfig\n const lineNumbers = pressConfig.markdown?.lineNumbers || false\n\n // Build shiki options with Ardo's custom line transformer\n const shikiOptions = hasThemeObject\n ? {\n themes: {\n light: themeConfig.light || \"github-light\",\n dark: themeConfig.dark || \"github-dark\",\n },\n defaultColor: false as const,\n transformers: [ardoLineTransformer({ globalLineNumbers: lineNumbers })],\n }\n : {\n theme: (themeConfig as string) || \"github-dark\",\n transformers: [ardoLineTransformer({ globalLineNumbers: lineNumbers })],\n }\n\n const mdxPlugin = mdx({\n include: /\\.(md|mdx)$/,\n remarkPlugins: [\n remarkFrontmatter,\n [remarkMdxFrontmatter, { name: \"frontmatter\" }],\n remarkGfm,\n remarkDirective,\n remarkContainersMdx,\n remarkCodeMeta,\n ],\n rehypePlugins: [[rehypeShiki, shikiOptions]],\n providerImportSource: \"ardo/mdx-provider\",\n })\n plugins.push(mdxPlugin as Plugin)\n\n // Add React Router Framework plugin (includes React plugin internally)\n const reactRouterPlugin = reactRouter()\n const reactRouterPlugins = (\n Array.isArray(reactRouterPlugin) ? reactRouterPlugin : [reactRouterPlugin]\n ).filter((p): p is Plugin => p != null)\n plugins.push(...reactRouterPlugins)\n\n // Add flatten plugin for GitHub Pages (must run after React Router build)\n if (githubPages) {\n let detectedBase: string | undefined\n\n const flattenPlugin: Plugin = {\n name: \"ardo:flatten-github-pages\",\n enforce: \"post\",\n\n configResolved(config) {\n if (config.base && config.base !== \"/\") {\n detectedBase = config.base\n }\n },\n\n closeBundle() {\n if (flattenExecuted || !detectedBase) {\n return\n }\n\n // Strip leading/trailing slashes to get the directory name\n const baseName = detectedBase.replace(/^\\/|\\/$/g, \"\")\n if (!baseName) return\n\n const buildDir = path.join(process.cwd(), \"build\", \"client\")\n const nestedDir = path.join(buildDir, baseName)\n\n if (!fsSync.existsSync(nestedDir)) {\n return\n }\n\n console.log(`[ardo] Flattening build/client/${baseName}/ to build/client/ for GitHub Pages`)\n copyRecursive(nestedDir, buildDir)\n fsSync.rmSync(nestedDir, { recursive: true, force: true })\n console.log(\"[ardo] Build output flattened successfully.\")\n\n flattenExecuted = true\n },\n }\n\n plugins.push(flattenPlugin)\n }\n\n return plugins\n}\n\nasync function generateSidebar(config: ResolvedConfig, routesDir: string) {\n const { themeConfig } = config\n\n if (themeConfig.sidebar && !Array.isArray(themeConfig.sidebar)) {\n return themeConfig.sidebar\n }\n\n if (themeConfig.sidebar && Array.isArray(themeConfig.sidebar) && themeConfig.sidebar.length > 0) {\n return themeConfig.sidebar\n }\n\n try {\n const sidebar = await scanDirectory(routesDir, routesDir)\n return sidebar\n } catch {\n return []\n }\n}\n\nasync function scanDirectory(\n dir: string,\n rootDir: string\n): Promise<Array<{ text: string; link?: string; items?: unknown[] }>> {\n const entries = await fs.readdir(dir, { withFileTypes: true })\n const items: Array<{ text: string; link?: string; items?: unknown[]; order?: number }> = []\n\n for (const entry of entries) {\n const fullPath = path.join(dir, entry.name)\n const relativePath = path.relative(rootDir, fullPath)\n\n if (entry.isDirectory()) {\n const children = await scanDirectory(fullPath, rootDir)\n if (children.length > 0) {\n // Check for index.mdx in the directory\n const indexPath = path.join(fullPath, \"index.mdx\")\n let link: string | undefined\n\n try {\n await fs.access(indexPath)\n link = \"/\" + relativePath.replace(/\\\\/g, \"/\")\n } catch {\n // No index.mdx\n }\n\n items.push({\n text: formatTitle(entry.name),\n link,\n items: children,\n })\n }\n } else if (\n (entry.name.endsWith(\".mdx\") || entry.name.endsWith(\".md\")) &&\n entry.name !== \"index.mdx\" &&\n entry.name !== \"index.md\"\n ) {\n const fileContent = await fs.readFile(fullPath, \"utf-8\")\n const { data: frontmatter } = matter(fileContent)\n\n const ext = entry.name.endsWith(\".mdx\") ? \".mdx\" : \".md\"\n const title = frontmatter.title || formatTitle(entry.name.replace(ext, \"\"))\n const order: number | undefined =\n typeof frontmatter.order === \"number\" ? frontmatter.order : undefined\n\n const link = \"/\" + relativePath.replace(ext, \"\").replace(/\\\\/g, \"/\")\n\n items.push({\n text: title,\n link,\n order,\n })\n }\n }\n\n items.sort((a, b) => {\n if (a.order !== undefined && b.order !== undefined) {\n return a.order - b.order\n }\n if (a.order !== undefined) return -1\n if (b.order !== undefined) return 1\n return a.text.localeCompare(b.text)\n })\n\n return items.map(({ order: _order, ...item }) => item)\n}\n\nfunction formatTitle(name: string): string {\n return name.replace(/[-_]/g, \" \").replace(/\\b\\w/g, (c) => c.toUpperCase())\n}\n\ninterface SearchDoc {\n id: string\n title: string\n content: string\n path: string\n section?: string\n}\n\nasync function generateSearchIndex(routesDir: string): Promise<SearchDoc[]> {\n const docs: SearchDoc[] = []\n\n async function scanForSearch(dir: string, section?: string): Promise<void> {\n try {\n const entries = await fs.readdir(dir, { withFileTypes: true })\n\n for (const entry of entries) {\n const fullPath = path.join(dir, entry.name)\n\n if (entry.isDirectory()) {\n // Use directory name as section for nested content\n const newSection = section\n ? `${section} > ${formatTitle(entry.name)}`\n : formatTitle(entry.name)\n await scanForSearch(fullPath, newSection)\n } else if (entry.name.endsWith(\".mdx\") || entry.name.endsWith(\".md\")) {\n const relativePath = path.relative(routesDir, fullPath)\n const fileContent = await fs.readFile(fullPath, \"utf-8\")\n\n // Extract frontmatter\n const { data: frontmatter, content: rawContent } = matter(fileContent)\n const ext = entry.name.endsWith(\".mdx\") ? \".mdx\" : \".md\"\n const title = frontmatter.title || formatTitle(entry.name.replace(ext, \"\"))\n let content = rawContent\n\n // Clean up content: remove markdown/MDX syntax, keep text\n content = content\n .replace(/```[\\s\\S]*?```/g, \"\") // Remove code blocks\n .replace(/`[^`]+`/g, \"\") // Remove inline code\n .replace(/import\\s+.*?from\\s+['\"].*?['\"]/g, \"\") // Remove imports\n .replace(/<[^>]+>/g, \"\") // Remove JSX tags\n .replace(/\\[([^\\]]+)\\]\\([^)]+\\)/g, \"$1\") // Links to text\n .replace(/[#*_~>]/g, \"\") // Remove markdown symbols\n .replace(/\\n+/g, \" \") // Newlines to spaces\n .replace(/\\s+/g, \" \") // Multiple spaces to single\n .trim()\n .slice(0, 2000) // Limit content size\n\n // Generate path for the route\n const routePath =\n entry.name === \"index.mdx\" || entry.name === \"index.md\"\n ? \"/\" + path.dirname(relativePath).replace(/\\\\/g, \"/\")\n : \"/\" + relativePath.replace(ext, \"\").replace(/\\\\/g, \"/\")\n\n // Skip root index (use \"/\" as path)\n const finalPath = routePath === \"/.\" ? \"/\" : routePath\n\n docs.push({\n id: relativePath,\n title,\n content,\n path: finalPath,\n section,\n })\n }\n }\n } catch (error) {\n console.warn(\n \"[ardo] Failed to scan for search index:\",\n error instanceof Error ? error.message : error\n )\n }\n }\n\n await scanForSearch(routesDir)\n return docs\n}\n\nexport default ardoPlugin\n","import {\n createHighlighter,\n type Highlighter,\n type BundledTheme,\n type ShikiTransformer,\n} from \"shiki\"\nimport type { Root, Element, Text } from \"hast\"\nimport { visit } from \"unist-util-visit\"\nimport type { MarkdownConfig } from \"../config/types\"\n\nexport type ShikiHighlighter = Highlighter\n\nexport async function createShikiHighlighter(config: MarkdownConfig): Promise<ShikiHighlighter> {\n const themeConfig = config.theme ?? {\n light: \"github-light\",\n dark: \"github-dark\",\n }\n\n const themes: BundledTheme[] =\n typeof themeConfig === \"string\" ? [themeConfig] : [themeConfig.light, themeConfig.dark]\n\n const highlighter = await createHighlighter({\n themes,\n langs: [\n \"javascript\",\n \"typescript\",\n \"jsx\",\n \"tsx\",\n \"json\",\n \"html\",\n \"css\",\n \"markdown\",\n \"bash\",\n \"shell\",\n \"yaml\",\n \"python\",\n \"rust\",\n \"go\",\n \"sql\",\n \"diff\",\n ],\n })\n\n return highlighter\n}\n\ninterface RehypeShikiOptions {\n highlighter: ShikiHighlighter\n config: MarkdownConfig\n}\n\nexport function rehypeShikiFromHighlighter(options: RehypeShikiOptions) {\n const { highlighter, config } = options\n\n const themeConfig = config.theme ?? {\n light: \"github-light\",\n dark: \"github-dark\",\n }\n\n return function (tree: Root) {\n visit(tree, \"element\", (node: Element, index, parent) => {\n if (\n node.tagName !== \"pre\" ||\n !node.children[0] ||\n (node.children[0] as Element).tagName !== \"code\"\n ) {\n return\n }\n\n const codeNode = node.children[0] as Element\n const className = (codeNode.properties?.className as string[]) || []\n const langClass = className.find((c) => c.startsWith(\"language-\"))\n const lang = langClass ? langClass.replace(\"language-\", \"\") : \"text\"\n\n const codeContent = getTextContent(codeNode)\n\n if (!codeContent.trim()) {\n return\n }\n\n try {\n let html: string\n\n if (typeof themeConfig === \"string\") {\n html = highlighter.codeToHtml(codeContent, {\n lang,\n theme: themeConfig,\n })\n } else {\n html = highlighter.codeToHtml(codeContent, {\n lang,\n themes: {\n light: themeConfig.light,\n dark: themeConfig.dark,\n },\n defaultColor: false,\n })\n }\n\n const metaString = (codeNode.properties?.metastring as string) || \"\"\n const lineNumbers = config.lineNumbers || metaString.includes(\"showLineNumbers\")\n const highlightLines = parseHighlightLines(metaString)\n const title = parseTitle(metaString)\n\n const wrapperHtml = buildCodeBlockHtml(html, {\n lang,\n lineNumbers,\n highlightLines,\n title,\n })\n\n if (parent && typeof index === \"number\") {\n const newNode: Element = {\n type: \"element\",\n tagName: \"div\",\n properties: {\n className: [\"ardo-code-block\"],\n \"data-lang\": lang,\n },\n children: [\n {\n type: \"raw\",\n value: wrapperHtml,\n } as unknown as Element,\n ],\n }\n parent.children[index] = newNode\n }\n } catch {\n // If highlighting fails, leave the node unchanged\n }\n })\n }\n}\n\nfunction getTextContent(node: Element | Text): string {\n if (node.type === \"text\") {\n return node.value\n }\n if (\"children\" in node) {\n return node.children.map((child) => getTextContent(child as Element | Text)).join(\"\")\n }\n return \"\"\n}\n\nfunction parseHighlightLines(meta: string): number[] {\n const match = meta.match(/\\{([\\d,-]+)\\}/)\n if (!match) return []\n\n const ranges = match[1].split(\",\")\n const lines: number[] = []\n\n for (const range of ranges) {\n if (range.includes(\"-\")) {\n const [start, end] = range.split(\"-\").map(Number)\n for (let i = start; i <= end; i++) {\n lines.push(i)\n }\n } else {\n lines.push(Number(range))\n }\n }\n\n return lines\n}\n\nfunction parseTitle(meta: string): string | undefined {\n const match = meta.match(/title=\"([^\"]+)\"/)\n return match ? match[1] : undefined\n}\n\ninterface CodeBlockOptions {\n lang: string\n lineNumbers: boolean\n highlightLines: number[]\n title?: string\n}\n\nfunction buildCodeBlockHtml(shikiHtml: string, options: CodeBlockOptions): string {\n const { lang, lineNumbers, highlightLines, title } = options\n\n let html = \"\"\n\n if (title) {\n html += `<div class=\"ardo-code-title\">${escapeHtml(title)}</div>`\n }\n\n html += `<div class=\"ardo-code-wrapper\" data-lang=\"${lang}\">`\n\n if (lineNumbers || highlightLines.length > 0) {\n const lines = shikiHtml.split(\"\\n\")\n const processedHtml = lines\n .map((line, i) => {\n const lineNum = i + 1\n const isHighlighted = highlightLines.includes(lineNum)\n const classes = [\"ardo-code-line\"]\n if (isHighlighted) classes.push(\"highlighted\")\n\n let prefix = \"\"\n if (lineNumbers) {\n prefix = `<span class=\"ardo-line-number\">${lineNum}</span>`\n }\n\n return `<span class=\"${classes.join(\" \")}\">${prefix}${line}</span>`\n })\n .join(\"\\n\")\n\n html += processedHtml\n } else {\n html += shikiHtml\n }\n\n html += `<button class=\"ardo-copy-button\" data-code=\"${encodeURIComponent(extractCodeFromHtml(shikiHtml))}\">\n <span class=\"ardo-copy-icon\">Copy</span>\n <span class=\"ardo-copied-icon\" style=\"display:none\">Copied!</span>\n </button>`\n\n html += \"</div>\"\n\n return html\n}\n\nfunction extractCodeFromHtml(html: string): string {\n return html\n .replace(/<[^>]+>/g, \"\")\n .replace(/&lt;/g, \"<\")\n .replace(/&gt;/g, \">\")\n .replace(/&amp;/g, \"&\")\n .replace(/&quot;/g, '\"')\n .replace(/&#39;/g, \"'\")\n}\n\nfunction escapeHtml(text: string): string {\n return text\n .replace(/&/g, \"&amp;\")\n .replace(/</g, \"&lt;\")\n .replace(/>/g, \"&gt;\")\n .replace(/\"/g, \"&quot;\")\n .replace(/'/g, \"&#39;\")\n}\n\n/**\n * Remark plugin that extracts code fence meta info and stores it as HAST\n * data attributes before MDX compilation can corrupt it.\n *\n * MDX treats `{...}` in code fence meta as JSX expressions, which corrupts\n * both the meta and the code content. This plugin strips the meta and\n * stores parsed info as `data-ardo-*` attributes that survive MDX.\n */\nexport function remarkCodeMeta() {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return function (tree: any) {\n visit(tree, \"code\", (node: { meta?: string | null; data?: Record<string, unknown> }) => {\n if (!node.meta) return\n\n const meta = node.meta\n const data = node.data || (node.data = {})\n const hProperties = (data.hProperties as Record<string, unknown>) || {}\n\n // Preserve meta as metastring property on the <code> HAST element.\n // @shikijs/rehype reads head.properties.metastring and passes it\n // to Shiki as meta.__raw, which ardoLineTransformer reads.\n hProperties.metastring = meta\n data.hProperties = hProperties\n\n // Strip meta from the MDAST node to prevent MDX from\n // misinterpreting {expressions} like {2,4-5} as JSX\n node.meta = null\n })\n }\n}\n\n/**\n * Shiki transformer that adds Ardo-specific line classes, highlighting,\n * line numbers, and title attributes to code blocks.\n *\n * Used with @shikijs/rehype in the MDX pipeline where proper HAST nodes\n * are required (raw HTML nodes cause \"Cannot handle unknown node `raw`\" errors).\n */\ninterface ArdoLineTransformerOptions {\n globalLineNumbers?: boolean\n}\n\nexport function ardoLineTransformer(options: ArdoLineTransformerOptions = {}): ShikiTransformer {\n let highlightLines: number[] = []\n let showLineNumbers = false\n let metaRaw = \"\"\n\n return {\n name: \"ardo:lines\",\n // preprocess runs BEFORE line() hooks, so state is ready for line()\n preprocess(_code, shikiOptions) {\n metaRaw = (shikiOptions.meta?.__raw as string) || \"\"\n highlightLines = parseHighlightLines(metaRaw)\n showLineNumbers = options.globalLineNumbers || metaRaw.includes(\"showLineNumbers\")\n },\n // pre runs AFTER line() — used only for node property modifications\n pre(node) {\n node.properties = node.properties || {}\n const title = parseTitle(metaRaw)\n if (title) {\n node.properties[\"data-title\"] = title\n }\n const labelMatch = metaRaw.match(/\\[([^\\]]+)\\]/)\n if (labelMatch) {\n node.properties[\"data-label\"] = labelMatch[1]\n }\n },\n line(node, line) {\n const currentClass = (node.properties?.class as string) || \"\"\n const classes = currentClass ? currentClass.split(\" \") : []\n classes.push(\"ardo-code-line\")\n\n if (highlightLines.includes(line)) {\n classes.push(\"highlighted\")\n }\n\n node.properties = node.properties || {}\n node.properties.class = classes.join(\" \")\n\n if (showLineNumbers) {\n node.children.unshift({\n type: \"element\",\n tagName: \"span\",\n properties: { class: \"ardo-line-number\" },\n children: [{ type: \"text\", value: String(line) }],\n } as Element)\n }\n },\n }\n}\n","import type { Root } from \"mdast\"\nimport type { ContainerDirective } from \"mdast-util-directive\"\nimport { visit } from \"unist-util-visit\"\n\nconst containerTypes = [\n \"tip\",\n \"warning\",\n \"danger\",\n \"info\",\n \"note\",\n \"details\",\n \"code-group\",\n] as const\ntype ContainerType = (typeof containerTypes)[number]\n\nconst defaultTitles: Record<ContainerType, string> = {\n tip: \"TIP\",\n warning: \"WARNING\",\n danger: \"DANGER\",\n info: \"INFO\",\n note: \"NOTE\",\n details: \"Details\",\n \"code-group\": \"\",\n}\n\nexport function remarkContainers() {\n return function (tree: Root) {\n visit(tree, \"containerDirective\", (node: ContainerDirective) => {\n const type = node.name as ContainerType\n\n if (!containerTypes.includes(type)) {\n return\n }\n\n const data = node.data || (node.data = {})\n\n const titleNode = node.children[0]\n let customTitle: string | undefined\n\n if (\n titleNode &&\n titleNode.type === \"paragraph\" &&\n titleNode.children[0]?.type === \"text\" &&\n titleNode.data?.directiveLabel\n ) {\n customTitle = (titleNode.children[0] as { value: string }).value\n node.children.shift()\n }\n\n const title = customTitle || defaultTitles[type]\n\n if (type === \"code-group\") {\n data.hName = \"div\"\n data.hProperties = {\n className: [\"ardo-code-group\"],\n }\n\n const tabs: Array<{ label: string; content: unknown }> = []\n\n for (const child of node.children) {\n if (child.type === \"code\") {\n const codeNode = child as { lang?: string; meta?: string; value: string }\n const meta = codeNode.meta || \"\"\n const labelMatch = meta.match(/\\[([^\\]]+)\\]/)\n const label = labelMatch ? labelMatch[1] : codeNode.lang || \"Code\"\n tabs.push({ label, content: child })\n }\n }\n\n const tabsHtml = tabs\n .map(\n (tab, i) =>\n `<button class=\"ardo-code-group-tab${i === 0 ? \" active\" : \"\"}\" data-index=\"${i}\">${escapeHtml(tab.label)}</button>`\n )\n .join(\"\")\n\n node.children = [\n {\n type: \"html\",\n value: `<div class=\"ardo-code-group-tabs\">${tabsHtml}</div>`,\n } as unknown as (typeof node.children)[number],\n {\n type: \"html\",\n value: '<div class=\"ardo-code-group-panels\">',\n } as unknown as (typeof node.children)[number],\n ...tabs.map(\n (tab, i) =>\n ({\n type: \"html\",\n value: `<div class=\"ardo-code-group-panel${i === 0 ? \" active\" : \"\"}\" data-index=\"${i}\">`,\n }) as unknown as (typeof node.children)[number]\n ),\n ...node.children.flatMap((child: (typeof node.children)[number], _i: number) => [\n child,\n {\n type: \"html\",\n value: \"</div>\",\n } as unknown as (typeof node.children)[number],\n ]),\n {\n type: \"html\",\n value: \"</div>\",\n } as unknown as (typeof node.children)[number],\n ]\n\n return\n }\n\n if (type === \"details\") {\n data.hName = \"details\"\n data.hProperties = {\n className: [\"ardo-details\"],\n }\n\n node.children.unshift({\n type: \"html\",\n value: `<summary class=\"ardo-details-summary\">${escapeHtml(title)}</summary>`,\n } as unknown as (typeof node.children)[number])\n\n return\n }\n\n data.hName = \"div\"\n data.hProperties = {\n className: [\"ardo-container\", `ardo-container-${type}`],\n }\n\n node.children.unshift({\n type: \"html\",\n value: `<p class=\"ardo-container-title\">${escapeHtml(title)}</p>`,\n } as unknown as (typeof node.children)[number])\n })\n }\n}\n\nfunction escapeHtml(text: string): string {\n return text\n .replace(/&/g, \"&amp;\")\n .replace(/</g, \"&lt;\")\n .replace(/>/g, \"&gt;\")\n .replace(/\"/g, \"&quot;\")\n .replace(/'/g, \"&#39;\")\n}\n\n/**\n * MDX-compatible remark plugin that converts container directives\n * (:::tip, :::warning, etc.) to MDX JSX elements (<Tip>, <Warning>, etc.)\n * that map to the React components in ardo/ui.\n *\n * Unlike remarkContainers (which uses raw HTML nodes for the title),\n * this produces proper MDX JSX flow elements that work with @mdx-js/rollup.\n */\nconst containerToComponent: Record<string, string> = {\n tip: \"Tip\",\n warning: \"Warning\",\n danger: \"Danger\",\n info: \"Info\",\n note: \"Note\",\n}\n\nexport function remarkContainersMdx() {\n return function (tree: Root) {\n visit(tree, \"containerDirective\", (node: ContainerDirective, index, parent) => {\n if (!parent || typeof index !== \"number\") return\n\n // Handle code-group directives\n if (node.name === \"code-group\") {\n // Extract tab labels from code block meta strings at remark level\n const labels = node.children\n .filter((child) => child.type === \"code\")\n .map((child) => {\n const meta = (child as { meta?: string }).meta || \"\"\n const match = meta.match(/\\[([^\\]]+)\\]/)\n return match ? match[1] : (child as { lang?: string }).lang || \"Code\"\n })\n\n const jsxNode = {\n type: \"mdxJsxFlowElement\" as const,\n name: \"CodeGroup\",\n attributes: [\n {\n type: \"mdxJsxAttribute\" as const,\n name: \"labels\",\n value: labels.join(\",\"),\n },\n ],\n children: node.children,\n }\n parent.children[index] = jsxNode as unknown as (typeof parent.children)[number]\n return\n }\n\n const componentName = containerToComponent[node.name]\n if (!componentName) return\n\n // Extract custom title from directive label\n const titleNode = node.children[0]\n let customTitle: string | undefined\n\n if (\n titleNode &&\n titleNode.type === \"paragraph\" &&\n titleNode.children[0]?.type === \"text\" &&\n titleNode.data?.directiveLabel\n ) {\n customTitle = (titleNode.children[0] as { value: string }).value\n node.children.shift()\n }\n\n // Build MDX JSX attributes\n const attributes: Array<{\n type: \"mdxJsxAttribute\"\n name: string\n value: string\n }> = []\n\n if (customTitle) {\n attributes.push({\n type: \"mdxJsxAttribute\",\n name: \"title\",\n value: customTitle,\n })\n }\n\n // Replace the directive node with an MDX JSX flow element\n const jsxNode = {\n type: \"mdxJsxFlowElement\" as const,\n name: componentName,\n attributes,\n children: node.children,\n }\n\n parent.children[index] = jsxNode as unknown as (typeof parent.children)[number]\n })\n }\n}\n","import type { Plugin } from \"vite\"\nimport fs from \"fs/promises\"\nimport fsSync from \"fs\"\nimport path from \"path\"\n\nexport interface ArdoRoutesPluginOptions {\n /** Directory where routes are located (default: \"./app/routes\") */\n routesDir?: string\n}\n\ninterface RouteInfo {\n /** URL path (e.g., \"/guide/getting-started\") */\n path: string\n /** File path relative to app directory (e.g., \"routes/guide/getting-started.mdx\") */\n file: string\n /** True if this is an index route */\n isIndex?: boolean\n}\n\n/**\n * Vite plugin that generates routes.ts for React Router Framework Mode.\n * Scans app/routes for .mdx and .tsx files and generates the route configuration.\n */\nexport function ardoRoutesPlugin(options: ArdoRoutesPluginOptions = {}): Plugin {\n let routesDir: string\n let appDir: string\n let routesFilePath: string\n\n function scanRoutesSync(dir: string, rootDir: string): RouteInfo[] {\n const routes: RouteInfo[] = []\n\n try {\n const entries = fsSync.readdirSync(dir, { withFileTypes: true })\n\n for (const entry of entries) {\n const fullPath = path.join(dir, entry.name)\n\n if (entry.isDirectory()) {\n // Recursively scan subdirectories\n const children = scanRoutesSync(fullPath, rootDir)\n routes.push(...children)\n } else if (\n entry.name.endsWith(\".mdx\") ||\n entry.name.endsWith(\".md\") ||\n entry.name.endsWith(\".tsx\")\n ) {\n // Skip special files\n if (entry.name === \"root.tsx\" || entry.name.startsWith(\"_\")) {\n continue\n }\n\n const relativePath = path.relative(rootDir, fullPath)\n const ext = entry.name.endsWith(\".mdx\")\n ? \".mdx\"\n : entry.name.endsWith(\".md\")\n ? \".md\"\n : \".tsx\"\n const baseName = entry.name.replace(ext, \"\")\n\n // Calculate URL path\n let urlPath: string\n if (baseName === \"index\" || baseName === \"home\") {\n // Index route - use parent directory path\n const parentDir = path.dirname(relativePath)\n urlPath = parentDir === \".\" ? \"/\" : \"/\" + parentDir.replace(/\\\\/g, \"/\")\n } else {\n // Regular route\n urlPath = \"/\" + relativePath.replace(ext, \"\").replace(/\\\\/g, \"/\")\n }\n\n // Handle dynamic segments ($param -> :param)\n urlPath = urlPath.replace(/\\$(\\w+)/g, \":$1\")\n\n routes.push({\n path: urlPath,\n file: \"routes/\" + relativePath.replace(/\\\\/g, \"/\"),\n isIndex: baseName === \"index\" || baseName === \"home\",\n })\n }\n }\n } catch {\n // Directory may not exist yet\n }\n\n return routes\n }\n\n function generateRoutesFile(routes: RouteInfo[]): string {\n // Sort routes: index routes first, then alphabetically\n const sortedRoutes = [...routes].sort((a, b) => {\n if (a.path === \"/\" && b.path !== \"/\") return -1\n if (b.path === \"/\" && a.path !== \"/\") return 1\n if (a.isIndex && !b.isIndex) return -1\n if (b.isIndex && !a.isIndex) return 1\n return a.path.localeCompare(b.path)\n })\n\n const entries = sortedRoutes.map((r) => {\n if (r.path === \"/\") {\n return ` index(\"${r.file}\"),`\n }\n // Remove leading slash for route path\n const routePath = r.path.substring(1)\n return ` route(\"${routePath}\", \"${r.file}\"),`\n })\n\n return `// AUTO-GENERATED by Ardo - Do not edit manually\n\nimport { type RouteConfig, route, index } from \"@react-router/dev/routes\"\n\nexport default [\n${entries.join(\"\\n\")}\n] satisfies RouteConfig\n`\n }\n\n function writeRoutesFileSync(): void {\n const routes = scanRoutesSync(routesDir, routesDir)\n\n // Skip if no routes found (directory might not exist yet)\n if (routes.length === 0) {\n return\n }\n\n const content = generateRoutesFile(routes)\n\n // Only write if content changed\n try {\n const existing = fsSync.readFileSync(routesFilePath, \"utf-8\")\n if (existing === content) {\n return\n }\n } catch {\n // File doesn't exist yet\n }\n\n // Ensure app directory exists\n fsSync.mkdirSync(appDir, { recursive: true })\n fsSync.writeFileSync(routesFilePath, content, \"utf-8\")\n console.log(`[ardo] Generated routes.ts with ${routes.length} routes`)\n }\n\n async function writeRoutesFile(): Promise<void> {\n const routes = scanRoutesSync(routesDir, routesDir)\n\n // Skip if no routes found (directory might not exist yet)\n if (routes.length === 0) {\n return\n }\n\n const content = generateRoutesFile(routes)\n\n // Only write if content changed\n try {\n const existing = await fs.readFile(routesFilePath, \"utf-8\")\n if (existing === content) {\n return\n }\n } catch {\n // File doesn't exist yet\n }\n\n // Ensure app directory exists\n await fs.mkdir(appDir, { recursive: true })\n await fs.writeFile(routesFilePath, content, \"utf-8\")\n }\n\n return {\n name: \"ardo:routes\",\n enforce: \"pre\",\n\n config(userConfig) {\n const root = userConfig.root || process.cwd()\n appDir = path.join(root, \"app\")\n routesDir = options.routesDir || path.join(appDir, \"routes\")\n routesFilePath = path.join(appDir, \"routes.ts\")\n\n // Generate routes synchronously during config phase\n // React Router needs routes.ts to exist before it starts\n try {\n writeRoutesFileSync()\n } catch (err) {\n console.warn(\"[ardo] Could not generate routes.ts in config phase:\", err)\n }\n },\n\n configResolved(config) {\n // Update paths if not set in config\n if (!appDir) {\n appDir = path.join(config.root, \"app\")\n routesDir = options.routesDir || path.join(appDir, \"routes\")\n routesFilePath = path.join(appDir, \"routes.ts\")\n }\n },\n\n async buildStart() {\n // Re-generate routes in buildStart for async support\n await writeRoutesFile()\n },\n\n configureServer(server) {\n // Watch for changes in routes directory\n server.watcher.add(routesDir)\n\n const handleChange = async (changedPath: string) => {\n if (\n changedPath.startsWith(routesDir) &&\n (changedPath.endsWith(\".mdx\") ||\n changedPath.endsWith(\".md\") ||\n changedPath.endsWith(\".tsx\"))\n ) {\n await writeRoutesFile()\n }\n }\n\n server.watcher.on(\"add\", handleChange)\n server.watcher.on(\"unlink\", handleChange)\n },\n }\n}\n","import fs from \"fs/promises\"\nimport path from \"path\"\nimport type { PageData, PageFrontmatter, TOCItem, ResolvedConfig } from \"../config/types\"\nimport { transformMarkdown } from \"../markdown/pipeline\"\n\nexport interface LoadDocOptions {\n slug: string\n contentDir: string\n config: ResolvedConfig\n}\n\nexport interface LoadDocResult {\n content: string\n frontmatter: PageFrontmatter\n toc: TOCItem[]\n filePath: string\n relativePath: string\n lastUpdated?: number\n}\n\nexport async function loadDoc(options: LoadDocOptions): Promise<LoadDocResult | null> {\n const { slug, contentDir, config } = options\n\n const possiblePaths = [\n path.join(contentDir, `${slug}.md`),\n path.join(contentDir, slug, \"index.md\"),\n ]\n\n let filePath: string | null = null\n let fileContent: string | null = null\n\n for (const tryPath of possiblePaths) {\n try {\n fileContent = await fs.readFile(tryPath, \"utf-8\")\n filePath = tryPath\n break\n } catch {\n continue\n }\n }\n\n if (!filePath || !fileContent) {\n return null\n }\n\n const result = await transformMarkdown(fileContent, config.markdown)\n const relativePath = path.relative(contentDir, filePath)\n\n let lastUpdated: number | undefined\n try {\n const stat = await fs.stat(filePath)\n lastUpdated = stat.mtimeMs\n } catch {\n // Ignore stat errors\n }\n\n return {\n content: result.html,\n frontmatter: result.frontmatter,\n toc: result.toc,\n filePath,\n relativePath,\n lastUpdated,\n }\n}\n\nexport async function loadAllDocs(contentDir: string, config: ResolvedConfig): Promise<PageData[]> {\n const docs: PageData[] = []\n\n async function scanDir(dir: string) {\n const entries = await fs.readdir(dir, { withFileTypes: true })\n\n for (const entry of entries) {\n const fullPath = path.join(dir, entry.name)\n\n if (entry.isDirectory()) {\n await scanDir(fullPath)\n } else if (entry.name.endsWith(\".md\")) {\n const fileContent = await fs.readFile(fullPath, \"utf-8\")\n const result = await transformMarkdown(fileContent, config.markdown)\n const relativePath = path.relative(contentDir, fullPath)\n\n let lastUpdated: number | undefined\n try {\n const stat = await fs.stat(fullPath)\n lastUpdated = stat.mtimeMs\n } catch {\n // Ignore stat errors\n }\n\n docs.push({\n title: result.frontmatter.title || formatTitle(entry.name.replace(/\\.md$/, \"\")),\n description: result.frontmatter.description,\n frontmatter: result.frontmatter,\n content: result.html,\n toc: result.toc,\n filePath: fullPath,\n relativePath,\n lastUpdated,\n })\n }\n }\n }\n\n await scanDir(contentDir)\n return docs\n}\n\nfunction formatTitle(name: string): string {\n return name.replace(/[-_]/g, \" \").replace(/\\b\\w/g, (c) => c.toUpperCase())\n}\n\nexport function getSlugFromPath(relativePath: string): string {\n return relativePath\n .replace(/\\.md$/, \"\")\n .replace(/\\/index$/, \"\")\n .replace(/\\\\/g, \"/\")\n}\n\nexport function getPageDataForRoute(docs: PageData[], slug: string): PageData | undefined {\n return docs.find((doc) => {\n const docSlug = getSlugFromPath(doc.relativePath)\n return docSlug === slug || docSlug === `${slug}/index`\n })\n}\n","import { unified } from \"unified\"\nimport remarkParse from \"remark-parse\"\nimport remarkGfm from \"remark-gfm\"\nimport remarkFrontmatter from \"remark-frontmatter\"\nimport remarkDirective from \"remark-directive\"\nimport remarkRehype from \"remark-rehype\"\nimport rehypeStringify from \"rehype-stringify\"\nimport matter from \"gray-matter\"\nimport type { MarkdownConfig, TOCItem, PageFrontmatter } from \"../config/types\"\nimport { remarkContainers } from \"./containers\"\nimport { remarkExtractToc, type TocExtraction } from \"./toc\"\nimport { createShikiHighlighter, rehypeShikiFromHighlighter, type ShikiHighlighter } from \"./shiki\"\nimport { rehypeLinks } from \"./links\"\n\nexport interface TransformResult {\n html: string\n frontmatter: PageFrontmatter\n toc: TOCItem[]\n}\n\nexport interface TransformOptions {\n basePath?: string\n highlighter?: ShikiHighlighter\n}\n\nexport async function transformMarkdown(\n content: string,\n config: MarkdownConfig,\n options: TransformOptions = {}\n): Promise<TransformResult> {\n const { data: frontmatter, content: markdownContent } = matter(content)\n const { basePath = \"/\", highlighter: providedHighlighter } = options\n\n const tocExtraction: TocExtraction = { toc: [] }\n const highlighter = providedHighlighter ?? (await createShikiHighlighter(config))\n\n const processor = unified()\n .use(remarkParse)\n .use(remarkFrontmatter, [\"yaml\"])\n .use(remarkGfm)\n .use(remarkDirective)\n .use(remarkContainers)\n .use(remarkExtractToc, { tocExtraction, levels: config.toc?.level ?? [2, 3] })\n .use(remarkRehype, { allowDangerousHtml: true })\n .use(rehypeShikiFromHighlighter, { highlighter, config })\n .use(rehypeLinks, { basePath })\n .use(rehypeStringify, { allowDangerousHtml: true })\n\n if (config.remarkPlugins) {\n for (const plugin of config.remarkPlugins) {\n processor.use(plugin as Parameters<typeof processor.use>[0])\n }\n }\n\n if (config.rehypePlugins) {\n for (const plugin of config.rehypePlugins) {\n processor.use(plugin as Parameters<typeof processor.use>[0])\n }\n }\n\n const result = await processor.process(markdownContent)\n\n return {\n html: String(result),\n frontmatter: frontmatter as PageFrontmatter,\n toc: tocExtraction.toc,\n }\n}\n\nexport async function transformMarkdownToReact(\n content: string,\n config: MarkdownConfig\n): Promise<TransformResult> {\n return transformMarkdown(content, config)\n}\n","import type { Root, Heading } from \"mdast\"\nimport { visit } from \"unist-util-visit\"\nimport type { TOCItem } from \"../config/types\"\n\nexport interface TocExtraction {\n toc: TOCItem[]\n}\n\ninterface TocOptions {\n tocExtraction: TocExtraction\n levels: [number, number]\n}\n\nexport function remarkExtractToc(options: TocOptions) {\n const { tocExtraction, levels } = options\n const [minLevel, maxLevel] = levels\n\n return function (tree: Root) {\n const headings: Array<{ text: string; level: number; id: string }> = []\n let headingIndex = 0\n\n visit(tree, \"heading\", (node: Heading) => {\n if (node.depth < minLevel || node.depth > maxLevel) {\n return\n }\n\n const text = getHeadingText(node)\n const slug = slugify(text)\n const id = slug || `heading-${headingIndex}`\n headingIndex++\n\n headings.push({\n text,\n level: node.depth,\n id,\n })\n\n // Add id to the heading node for anchor links\n const data = node.data || (node.data = {})\n const hProperties = (data.hProperties || (data.hProperties = {})) as Record<string, string>\n hProperties.id = id\n })\n\n tocExtraction.toc = buildTocTree(headings, minLevel)\n }\n}\n\nfunction getHeadingText(node: Heading): string {\n const textParts: string[] = []\n\n function extractText(child: unknown) {\n if (!child || typeof child !== \"object\") return\n\n const typedChild = child as { type?: string; value?: string; children?: unknown[] }\n\n if (typedChild.type === \"text\") {\n textParts.push(typedChild.value || \"\")\n } else if (typedChild.type === \"inlineCode\") {\n textParts.push(typedChild.value || \"\")\n } else if (Array.isArray(typedChild.children)) {\n typedChild.children.forEach(extractText)\n }\n }\n\n node.children.forEach(extractText)\n return textParts.join(\"\")\n}\n\nfunction slugify(text: string): string {\n return text\n .toLowerCase()\n .trim()\n .replace(/[^\\w\\s-]/g, \"\")\n .replace(/[\\s_-]+/g, \"-\")\n .replace(/^-+|-+$/g, \"\")\n}\n\nfunction buildTocTree(\n headings: Array<{ text: string; level: number; id: string }>,\n _minLevel: number\n): TOCItem[] {\n const result: TOCItem[] = []\n const stack: Array<{ item: TOCItem; level: number }> = []\n\n for (const heading of headings) {\n const item: TOCItem = {\n id: heading.id,\n text: heading.text,\n level: heading.level,\n }\n\n while (stack.length > 0 && stack[stack.length - 1].level >= heading.level) {\n stack.pop()\n }\n\n if (stack.length === 0) {\n result.push(item)\n } else {\n const parent = stack[stack.length - 1].item\n if (!parent.children) {\n parent.children = []\n }\n parent.children.push(item)\n }\n\n stack.push({ item, level: heading.level })\n }\n\n return result\n}\n\nexport function flattenToc(toc: TOCItem[]): TOCItem[] {\n const result: TOCItem[] = []\n\n function flatten(items: TOCItem[]) {\n for (const item of items) {\n result.push(item)\n if (item.children) {\n flatten(item.children)\n }\n }\n }\n\n flatten(toc)\n return result\n}\n","import { visit } from \"unist-util-visit\"\nimport type { Root, Element } from \"hast\"\n\nexport interface RehypeLinkOptions {\n basePath: string\n}\n\n/**\n * Rehype plugin that rewrites internal links to include the basePath.\n * This is needed for static sites deployed to subpaths (e.g., GitHub Pages).\n */\nexport function rehypeLinks(options: RehypeLinkOptions) {\n const { basePath } = options\n\n // Normalize basePath: ensure it starts with / and doesn't end with /\n const normalizedBase = basePath === \"/\" ? \"\" : basePath.replace(/\\/$/, \"\")\n\n return (tree: Root) => {\n if (!normalizedBase) {\n // No basePath to add\n return\n }\n\n visit(tree, \"element\", (node: Element) => {\n if (node.tagName === \"a\") {\n const href = node.properties?.href\n\n if (typeof href === \"string\") {\n // Only rewrite internal links that start with /\n // Don't rewrite: external URLs, anchors, relative paths, or already prefixed paths\n if (href.startsWith(\"/\") && !href.startsWith(\"//\") && !href.startsWith(normalizedBase)) {\n node.properties = node.properties || {}\n node.properties.href = normalizedBase + href\n }\n }\n }\n })\n }\n}\n","import fs from \"fs/promises\"\nimport type { Dirent } from \"fs\"\nimport path from \"path\"\nimport matter from \"gray-matter\"\nimport type { SidebarItem, ResolvedConfig } from \"../config/types\"\n\nexport interface SidebarGenerationOptions {\n contentDir: string\n basePath: string\n config: ResolvedConfig\n}\n\nexport async function generateSidebar(options: SidebarGenerationOptions): Promise<SidebarItem[]> {\n const { contentDir, basePath, config } = options\n\n const configSidebar = config.themeConfig.sidebar\n\n if (configSidebar) {\n if (Array.isArray(configSidebar) && configSidebar.length > 0) {\n return configSidebar\n }\n if (!Array.isArray(configSidebar)) {\n return []\n }\n }\n\n return await scanDirectoryForSidebar(contentDir, contentDir, basePath)\n}\n\nasync function scanDirectoryForSidebar(\n dir: string,\n rootDir: string,\n _basePath: string\n): Promise<SidebarItem[]> {\n let entries: Dirent[]\n\n try {\n entries = (await fs.readdir(dir, { withFileTypes: true })) as Dirent[]\n } catch {\n return []\n }\n\n interface SidebarItemWithOrder extends SidebarItem {\n order?: number\n }\n\n const items: SidebarItemWithOrder[] = []\n\n for (const entry of entries) {\n const fullPath = path.join(dir, entry.name)\n const relativePath = path.relative(rootDir, fullPath)\n\n if (entry.name.startsWith(\".\") || entry.name.startsWith(\"_\")) {\n continue\n }\n\n if (entry.isDirectory()) {\n const children = await scanDirectoryForSidebar(fullPath, rootDir, _basePath)\n\n if (children.length > 0) {\n const indexPath = path.join(fullPath, \"index.md\")\n let link: string | undefined\n let title = formatTitle(entry.name)\n let order: number | undefined\n\n try {\n const indexContent = await fs.readFile(indexPath, \"utf-8\")\n const { data: frontmatter } = matter(indexContent)\n\n if (frontmatter.title) {\n title = frontmatter.title\n }\n if (typeof frontmatter.order === \"number\") {\n order = frontmatter.order\n }\n\n // Don't include basePath - React Router handles it automatically\n link = normalizePath(relativePath)\n } catch {\n // No index.md file\n }\n\n items.push({\n text: title,\n link,\n collapsed: false,\n items: children,\n order,\n })\n }\n } else if (entry.name.endsWith(\".md\") && entry.name !== \"index.md\") {\n const fileContent = await fs.readFile(fullPath, \"utf-8\")\n const { data: frontmatter } = matter(fileContent)\n\n if (frontmatter.sidebar === false) {\n continue\n }\n\n const title = frontmatter.title || formatTitle(entry.name.replace(/\\.md$/, \"\"))\n const order = typeof frontmatter.order === \"number\" ? frontmatter.order : undefined\n\n // Don't include basePath - React Router handles it automatically\n const link = normalizePath(relativePath.replace(/\\.md$/, \"\"))\n\n items.push({\n text: title,\n link,\n order,\n })\n }\n }\n\n items.sort((a, b) => {\n if (a.order !== undefined && b.order !== undefined) {\n return a.order - b.order\n }\n if (a.order !== undefined) return -1\n if (b.order !== undefined) return 1\n return a.text.localeCompare(b.text)\n })\n\n return items.map(({ order: _order, ...item }) => item)\n}\n\nfunction formatTitle(name: string): string {\n return name\n .replace(/^\\d+-/, \"\")\n .replace(/[-_]/g, \" \")\n .replace(/\\b\\w/g, (c) => c.toUpperCase())\n}\n\nfunction normalizePath(p: string): string {\n return \"/\" + p.replace(/\\\\/g, \"/\").replace(/^\\/+/, \"\")\n}\n"],"mappings":";;;;;;;;AAKA,SAAS,mBAAmB;AAC5B,OAAO,SAAS;AAChB,OAAO,uBAAuB;AAC9B,OAAO,0BAA0B;AACjC,OAAO,eAAe;AACtB,OAAO,qBAAqB;AAC5B,OAAO,iBAAiB;;;ACXxB;AAAA,EACE;AAAA,OAIK;AAEP,SAAS,aAAa;AAKtB,eAAsB,uBAAuB,QAAmD;AAC9F,QAAM,cAAc,OAAO,SAAS;AAAA,IAClC,OAAO;AAAA,IACP,MAAM;AAAA,EACR;AAEA,QAAM,SACJ,OAAO,gBAAgB,WAAW,CAAC,WAAW,IAAI,CAAC,YAAY,OAAO,YAAY,IAAI;AAExF,QAAM,cAAc,MAAM,kBAAkB;AAAA,IAC1C;AAAA,IACA,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A,MACH;AAAA,IACF,WAAW,MAAM,KAAK,SAAS,KAAK,KAAK,MAAM,SAAS,YAAY;AAClE,YAAM,cAAc,MAAMF,IAAG,SAAS,UAAU,OAAO;AACvD,YAAM,EAAE,MAAM,YAAY,IAAIE,QAAO,WAAW;AAEhD,UAAI,YAAY,YAAY,OAAO;AACjC;AAAA,MACF;AAEA,YAAM,QAAQ,YAAY,SAASE,aAAY,MAAM,KAAK,QAAQ,SAAS,EAAE,CAAC;AAC9E,YAAM,QAAQ,OAAO,YAAY,UAAU,WAAW,YAAY,QAAQ;AAG1E,YAAM,OAAO,cAAc,aAAa,QAAQ,SAAS,EAAE,CAAC;AAE5D,YAAM,KAAK;AAAA,QACT,MAAM;AAAA,QACN;AAAA,QACA;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AAEA,QAAM,KAAK,CAAC,GAAG,MAAM;AACnB,QAAI,EAAE,UAAU,UAAa,EAAE,UAAU,QAAW;AAClD,aAAO,EAAE,QAAQ,EAAE;AAAA,IACrB;AACA,QAAI,EAAE,UAAU,OAAW,QAAO;AAClC,QAAI,EAAE,UAAU,OAAW,QAAO;AAClC,WAAO,EAAE,KAAK,cAAc,EAAE,IAAI;AAAA,EACpC,CAAC;AAED,SAAO,MAAM,IAAI,CAAC,EAAE,OAAO,QAAQ,GAAG,KAAK,MAAM,IAAI;AACvD;AAEA,SAASA,aAAY,MAAsB;AACzC,SAAO,KACJ,QAAQ,SAAS,EAAE,EACnB,QAAQ,SAAS,GAAG,EACpB,QAAQ,SAAS,CAAC,MAAM,EAAE,YAAY,CAAC;AAC5C;AAEA,SAAS,cAAc,GAAmB;AACxC,SAAO,MAAM,EAAE,QAAQ,OAAO,GAAG,EAAE,QAAQ,QAAQ,EAAE;AACvD;","names":["visit","escapeHtml","jsxNode","fs","fsSync","path","path","fsSync","fs","fs","path","remarkGfm","remarkFrontmatter","remarkDirective","matter","visit","visit","matter","remarkFrontmatter","remarkGfm","remarkDirective","path","fs","formatTitle","fs","path","matter","generateSidebar","formatTitle"]}
package/dist/index.js CHANGED
@@ -7,7 +7,7 @@ import {
7
7
  loadDoc,
8
8
  transformMarkdown,
9
9
  transformMarkdownToReact
10
- } from "./chunk-5NCTTGEC.js";
10
+ } from "./chunk-R6CRXVQK.js";
11
11
  import {
12
12
  defineConfig,
13
13
  loadConfig,
@@ -10,7 +10,7 @@ import {
10
10
  loadDoc,
11
11
  transformMarkdown,
12
12
  transformMarkdownToReact
13
- } from "../chunk-5NCTTGEC.js";
13
+ } from "../chunk-R6CRXVQK.js";
14
14
  import "../chunk-CGFRUWNJ.js";
15
15
  import "../chunk-4IRLOOXV.js";
16
16
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ardo",
3
- "version": "2.2.0",
3
+ "version": "2.2.1",
4
4
  "description": "React-first Static Documentation Framework",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/vite/plugin.ts","../src/markdown/shiki.ts","../src/markdown/containers.ts","../src/vite/routes-plugin.ts","../src/runtime/loader.ts","../src/markdown/pipeline.ts","../src/markdown/toc.ts","../src/markdown/links.ts","../src/runtime/sidebar.ts"],"sourcesContent":["import type { Plugin, UserConfig } from \"vite\"\nimport type { PressConfig, ProjectMeta, ResolvedConfig } from \"../config/types\"\nimport type { TypeDocConfig } from \"../typedoc/types\"\nimport { resolveConfig } from \"../config/index\"\nimport { generateApiDocs } from \"../typedoc/generator\"\nimport { reactRouter } from \"@react-router/dev/vite\"\nimport mdx from \"@mdx-js/rollup\"\nimport remarkFrontmatter from \"remark-frontmatter\"\nimport remarkMdxFrontmatter from \"remark-mdx-frontmatter\"\nimport remarkGfm from \"remark-gfm\"\nimport remarkDirective from \"remark-directive\"\nimport rehypeShiki from \"@shikijs/rehype\"\nimport { ardoLineTransformer, remarkCodeMeta } from \"../markdown/shiki\"\nimport { remarkContainersMdx } from \"../markdown/containers\"\nimport fs from \"fs/promises\"\nimport fsSync from \"fs\"\nimport path from \"path\"\nimport { execSync } from \"child_process\"\nimport matter from \"gray-matter\"\nimport { ardoRoutesPlugin, type ArdoRoutesPluginOptions } from \"./routes-plugin\"\n\n/**\n * Finds the package root by looking for package.json in parent directories.\n * Returns the path relative to cwd, or undefined if not found.\n */\nfunction findPackageRoot(cwd: string): string | undefined {\n let dir = path.resolve(cwd)\n const root = path.parse(dir).root\n\n while (dir !== root) {\n const parentDir = path.dirname(dir)\n const packageJsonPath = path.join(parentDir, \"package.json\")\n\n if (fsSync.existsSync(packageJsonPath)) {\n // Return relative path from cwd to parent\n return path.relative(cwd, parentDir) || \".\"\n }\n\n dir = parentDir\n }\n\n return undefined\n}\n\n/**\n * Detects the GitHub repository name from git remote URL.\n * Returns the repo name (e.g., 'ardo' from 'github.com/sebastian-software/ardo')\n * or undefined if not a GitHub repo.\n */\nfunction detectGitHubRepoName(cwd: string): string | undefined {\n try {\n const remoteUrl = execSync(\"git remote get-url origin\", {\n cwd,\n encoding: \"utf-8\",\n stdio: [\"pipe\", \"pipe\", \"pipe\"],\n }).trim()\n\n // Parse GitHub URL (supports both HTTPS and SSH)\n // https://github.com/user/repo.git\n // git@github.com:user/repo.git\n const match = remoteUrl.match(/github\\.com[/:][\\w-]+\\/([\\w.-]+?)(?:\\.git)?$/)\n return match?.[1]\n } catch {\n return undefined\n }\n}\n\n/**\n * Reads project metadata from the nearest package.json.\n */\nfunction readProjectMeta(root: string): ProjectMeta {\n const pkgPath = path.join(root, \"package.json\")\n try {\n const raw = fsSync.readFileSync(pkgPath, \"utf-8\")\n const pkg = JSON.parse(raw)\n\n let repository: string | undefined\n if (typeof pkg.repository === \"string\") {\n repository = pkg.repository\n } else if (pkg.repository?.url) {\n // Normalize git+https://... or git://... URLs\n repository = pkg.repository.url\n .replace(/^git\\+/, \"\")\n .replace(/^git:\\/\\//, \"https://\")\n .replace(/\\.git$/, \"\")\n }\n\n let author: string | undefined\n if (typeof pkg.author === \"string\") {\n author = pkg.author\n } else if (pkg.author?.name) {\n author = pkg.author.name\n }\n\n return {\n name: pkg.name,\n homepage: pkg.homepage,\n repository,\n version: pkg.version,\n author,\n license: pkg.license,\n }\n } catch {\n return {}\n }\n}\n\n/**\n * Recursively copies files from src to dest, overwriting existing files.\n */\nfunction copyRecursive(src: string, dest: string) {\n const stat = fsSync.statSync(src)\n\n if (stat.isDirectory()) {\n if (!fsSync.existsSync(dest)) {\n fsSync.mkdirSync(dest, { recursive: true })\n }\n for (const item of fsSync.readdirSync(src)) {\n copyRecursive(path.join(src, item), path.join(dest, item))\n }\n } else {\n fsSync.copyFileSync(src, dest)\n }\n}\n\n/**\n * Detects the GitHub Pages basename from the git remote URL.\n * Returns `\"/repo-name/\"` if a GitHub repo is detected, otherwise `undefined`.\n *\n * Use this in `react-router.config.ts` to synchronize client-side routing\n * with the Vite `base` path that Ardo auto-detects:\n *\n * ```ts\n * import { detectGitHubBasename } from \"ardo/vite\"\n *\n * export default {\n * ssr: false,\n * prerender: true,\n * basename: detectGitHubBasename(),\n * } satisfies Config\n * ```\n */\nexport function detectGitHubBasename(cwd?: string): string | undefined {\n const repoName = detectGitHubRepoName(cwd || process.cwd())\n return repoName ? `/${repoName}/` : undefined\n}\n\nconst VIRTUAL_MODULE_ID = \"virtual:ardo/config\"\nconst RESOLVED_VIRTUAL_MODULE_ID = \"\\0\" + VIRTUAL_MODULE_ID\n\nconst VIRTUAL_SIDEBAR_ID = \"virtual:ardo/sidebar\"\nconst RESOLVED_VIRTUAL_SIDEBAR_ID = \"\\0\" + VIRTUAL_SIDEBAR_ID\n\nconst VIRTUAL_SEARCH_ID = \"virtual:ardo/search-index\"\nconst RESOLVED_VIRTUAL_SEARCH_ID = \"\\0\" + VIRTUAL_SEARCH_ID\n\n// Module-level flags to prevent duplicate operations across plugin instances\n// This is necessary because React Router creates multiple Vite instances\nlet typedocGenerated = false\nlet flattenExecuted = false\n\nexport interface ArdoPluginOptions extends Partial<PressConfig> {\n /** Options for the routes generator plugin */\n routes?: ArdoRoutesPluginOptions | false\n /**\n * Auto-detect GitHub repository and set base path for GitHub Pages.\n * When true, automatically sets `base: '/repo-name/'` if deploying to GitHub Pages.\n * @default true\n */\n githubPages?: boolean\n /**\n * Directory where routes are located.\n * @default \"./app/routes\"\n */\n routesDir?: string\n}\n\nexport function ardoPlugin(options: ArdoPluginOptions = {}): Plugin[] {\n let resolvedConfig: ResolvedConfig\n let routesDir: string\n\n // Extract ardo-specific options from the rest (which is PressConfig)\n const {\n routes,\n typedoc,\n githubPages = true,\n routesDir: routesDirOption,\n ...pressConfig\n } = options\n\n const mainPlugin: Plugin = {\n name: \"ardo\",\n enforce: \"pre\",\n\n config(userConfig, env): UserConfig {\n const root = userConfig.root || process.cwd()\n routesDir = routesDirOption || path.join(root, \"app\", \"routes\")\n\n const result: UserConfig = {\n optimizeDeps: {\n exclude: [\"ardo/ui/styles.css\"],\n },\n ssr: {\n noExternal: [\"ardo\"],\n },\n }\n\n // Auto-detect GitHub Pages base path for production builds\n if (githubPages && env.command === \"build\" && !userConfig.base) {\n const repoName = detectGitHubRepoName(root)\n if (repoName) {\n result.base = `/${repoName}/`\n console.log(`[ardo] GitHub Pages detected, using base: ${result.base}`)\n }\n }\n\n return result\n },\n\n async configResolved(config) {\n const root = config.root\n routesDir = routesDirOption || path.join(root, \"app\", \"routes\")\n\n // Auto-detect project metadata from package.json\n const detectedProject = readProjectMeta(root)\n const project: ProjectMeta = { ...detectedProject, ...pressConfig.project }\n\n const defaultConfig: PressConfig = {\n title: pressConfig.title ?? \"Ardo\",\n description: pressConfig.description ?? \"Documentation powered by Ardo\",\n }\n\n // For React Router, contentDir is the routes directory\n const configWithRoutes = {\n ...defaultConfig,\n ...pressConfig,\n project,\n srcDir: routesDir,\n }\n\n resolvedConfig = resolveConfig(configWithRoutes, root)\n },\n\n resolveId(id) {\n if (id === VIRTUAL_MODULE_ID) {\n return RESOLVED_VIRTUAL_MODULE_ID\n }\n if (id === VIRTUAL_SIDEBAR_ID) {\n return RESOLVED_VIRTUAL_SIDEBAR_ID\n }\n if (id === VIRTUAL_SEARCH_ID) {\n return RESOLVED_VIRTUAL_SEARCH_ID\n }\n },\n\n async load(id) {\n if (id === RESOLVED_VIRTUAL_MODULE_ID) {\n const clientConfig = {\n title: resolvedConfig.title,\n description: resolvedConfig.description,\n base: resolvedConfig.base,\n lang: resolvedConfig.lang,\n themeConfig: resolvedConfig.themeConfig,\n project: resolvedConfig.project,\n }\n return `export default ${JSON.stringify(clientConfig)}`\n }\n\n if (id === RESOLVED_VIRTUAL_SIDEBAR_ID) {\n const sidebar = await generateSidebar(resolvedConfig, routesDir)\n return `export default ${JSON.stringify(sidebar)}`\n }\n\n if (id === RESOLVED_VIRTUAL_SEARCH_ID) {\n const searchIndex = await generateSearchIndex(routesDir)\n return `export default ${JSON.stringify(searchIndex)}`\n }\n },\n }\n\n const plugins: Plugin[] = [mainPlugin]\n\n // Add routes plugin unless explicitly disabled\n if (routes !== false) {\n plugins.push(\n ardoRoutesPlugin({\n routesDir: routesDirOption,\n ...routes,\n })\n )\n }\n\n // Add TypeDoc plugin if enabled\n if (typedoc) {\n // Find package root to use as default entry point and tsconfig base\n const packageRoot = findPackageRoot(process.cwd())\n const defaultEntryPoint = packageRoot ? `${packageRoot}/src/index.ts` : \"./src/index.ts\"\n const defaultTsconfig = packageRoot ? `${packageRoot}/tsconfig.json` : \"./tsconfig.json\"\n\n const defaultTypedocConfig: TypeDocConfig = {\n enabled: true,\n entryPoints: [defaultEntryPoint],\n tsconfig: defaultTsconfig,\n out: \"api-reference\",\n excludePrivate: true,\n excludeInternal: true,\n }\n\n const typedocConfig: TypeDocConfig =\n typedoc === true ? defaultTypedocConfig : { ...defaultTypedocConfig, ...typedoc }\n\n const typedocPlugin: Plugin = {\n name: \"ardo:typedoc\",\n\n async buildStart() {\n // Use module-level flag to prevent duplicate generation across plugin instances\n if (typedocGenerated || !typedocConfig.enabled) {\n return\n }\n\n console.log(\"[ardo] Generating API documentation with TypeDoc...\")\n const startTime = Date.now()\n try {\n const outputDir = routesDirOption || \"./app/routes\"\n const docs = await generateApiDocs(typedocConfig, outputDir)\n const duration = Date.now() - startTime\n console.log(`[ardo] Generated ${docs.length} API documentation pages in ${duration}ms`)\n } catch (error) {\n console.warn(\"[ardo] TypeDoc generation failed. API documentation will not be available.\")\n console.warn(\"[ardo] Check your typedoc.entryPoints configuration.\")\n if (error instanceof Error) {\n console.warn(`[ardo] Error: ${error.message}`)\n }\n }\n typedocGenerated = true\n },\n }\n\n plugins.unshift(typedocPlugin)\n }\n\n // Add MDX plugin with Ardo's markdown pipeline\n const themeConfig = pressConfig.markdown?.theme\n const hasThemeObject = themeConfig && typeof themeConfig === \"object\" && \"light\" in themeConfig\n const lineNumbers = pressConfig.markdown?.lineNumbers || false\n\n // Build shiki options with Ardo's custom line transformer\n const shikiOptions = hasThemeObject\n ? {\n themes: {\n light: themeConfig.light || \"github-light\",\n dark: themeConfig.dark || \"github-dark\",\n },\n defaultColor: false as const,\n transformers: [ardoLineTransformer({ globalLineNumbers: lineNumbers })],\n }\n : {\n theme: (themeConfig as string) || \"github-dark\",\n transformers: [ardoLineTransformer({ globalLineNumbers: lineNumbers })],\n }\n\n const mdxPlugin = mdx({\n include: /\\.(md|mdx)$/,\n remarkPlugins: [\n remarkFrontmatter,\n [remarkMdxFrontmatter, { name: \"frontmatter\" }],\n remarkGfm,\n remarkDirective,\n remarkContainersMdx,\n remarkCodeMeta,\n ],\n rehypePlugins: [[rehypeShiki, shikiOptions]],\n providerImportSource: \"ardo/mdx-provider\",\n })\n plugins.push(mdxPlugin as Plugin)\n\n // Add React Router Framework plugin (includes React plugin internally)\n const reactRouterPlugin = reactRouter()\n const reactRouterPlugins = (\n Array.isArray(reactRouterPlugin) ? reactRouterPlugin : [reactRouterPlugin]\n ).filter((p): p is Plugin => p != null)\n plugins.push(...reactRouterPlugins)\n\n // Add flatten plugin for GitHub Pages (must run after React Router build)\n if (githubPages) {\n let detectedBase: string | undefined\n\n const flattenPlugin: Plugin = {\n name: \"ardo:flatten-github-pages\",\n enforce: \"post\",\n\n configResolved(config) {\n if (config.base && config.base !== \"/\") {\n detectedBase = config.base\n }\n },\n\n closeBundle() {\n if (flattenExecuted || !detectedBase) {\n return\n }\n\n // Strip leading/trailing slashes to get the directory name\n const baseName = detectedBase.replace(/^\\/|\\/$/g, \"\")\n if (!baseName) return\n\n const buildDir = path.join(process.cwd(), \"build\", \"client\")\n const nestedDir = path.join(buildDir, baseName)\n\n if (!fsSync.existsSync(nestedDir)) {\n return\n }\n\n console.log(`[ardo] Flattening build/client/${baseName}/ to build/client/ for GitHub Pages`)\n copyRecursive(nestedDir, buildDir)\n fsSync.rmSync(nestedDir, { recursive: true, force: true })\n console.log(\"[ardo] Build output flattened successfully.\")\n\n flattenExecuted = true\n },\n }\n\n plugins.push(flattenPlugin)\n }\n\n return plugins\n}\n\nasync function generateSidebar(config: ResolvedConfig, routesDir: string) {\n const { themeConfig } = config\n\n if (themeConfig.sidebar && !Array.isArray(themeConfig.sidebar)) {\n return themeConfig.sidebar\n }\n\n if (themeConfig.sidebar && Array.isArray(themeConfig.sidebar) && themeConfig.sidebar.length > 0) {\n return themeConfig.sidebar\n }\n\n try {\n const sidebar = await scanDirectory(routesDir, routesDir)\n return sidebar\n } catch {\n return []\n }\n}\n\nasync function scanDirectory(\n dir: string,\n rootDir: string\n): Promise<Array<{ text: string; link?: string; items?: unknown[] }>> {\n const entries = await fs.readdir(dir, { withFileTypes: true })\n const items: Array<{ text: string; link?: string; items?: unknown[]; order?: number }> = []\n\n for (const entry of entries) {\n const fullPath = path.join(dir, entry.name)\n const relativePath = path.relative(rootDir, fullPath)\n\n if (entry.isDirectory()) {\n const children = await scanDirectory(fullPath, rootDir)\n if (children.length > 0) {\n // Check for index.mdx in the directory\n const indexPath = path.join(fullPath, \"index.mdx\")\n let link: string | undefined\n\n try {\n await fs.access(indexPath)\n link = \"/\" + relativePath.replace(/\\\\/g, \"/\")\n } catch {\n // No index.mdx\n }\n\n items.push({\n text: formatTitle(entry.name),\n link,\n items: children,\n })\n }\n } else if (\n (entry.name.endsWith(\".mdx\") || entry.name.endsWith(\".md\")) &&\n entry.name !== \"index.mdx\" &&\n entry.name !== \"index.md\"\n ) {\n const fileContent = await fs.readFile(fullPath, \"utf-8\")\n const { data: frontmatter } = matter(fileContent)\n\n const ext = entry.name.endsWith(\".mdx\") ? \".mdx\" : \".md\"\n const title = frontmatter.title || formatTitle(entry.name.replace(ext, \"\"))\n const order: number | undefined =\n typeof frontmatter.order === \"number\" ? frontmatter.order : undefined\n\n const link = \"/\" + relativePath.replace(ext, \"\").replace(/\\\\/g, \"/\")\n\n items.push({\n text: title,\n link,\n order,\n })\n }\n }\n\n items.sort((a, b) => {\n if (a.order !== undefined && b.order !== undefined) {\n return a.order - b.order\n }\n if (a.order !== undefined) return -1\n if (b.order !== undefined) return 1\n return a.text.localeCompare(b.text)\n })\n\n return items.map(({ order: _order, ...item }) => item)\n}\n\nfunction formatTitle(name: string): string {\n return name.replace(/[-_]/g, \" \").replace(/\\b\\w/g, (c) => c.toUpperCase())\n}\n\ninterface SearchDoc {\n id: string\n title: string\n content: string\n path: string\n section?: string\n}\n\nasync function generateSearchIndex(routesDir: string): Promise<SearchDoc[]> {\n const docs: SearchDoc[] = []\n\n async function scanForSearch(dir: string, section?: string): Promise<void> {\n try {\n const entries = await fs.readdir(dir, { withFileTypes: true })\n\n for (const entry of entries) {\n const fullPath = path.join(dir, entry.name)\n\n if (entry.isDirectory()) {\n // Use directory name as section for nested content\n const newSection = section\n ? `${section} > ${formatTitle(entry.name)}`\n : formatTitle(entry.name)\n await scanForSearch(fullPath, newSection)\n } else if (entry.name.endsWith(\".mdx\") || entry.name.endsWith(\".md\")) {\n const relativePath = path.relative(routesDir, fullPath)\n const fileContent = await fs.readFile(fullPath, \"utf-8\")\n\n // Extract frontmatter\n const { data: frontmatter, content: rawContent } = matter(fileContent)\n const ext = entry.name.endsWith(\".mdx\") ? \".mdx\" : \".md\"\n const title = frontmatter.title || formatTitle(entry.name.replace(ext, \"\"))\n let content = rawContent\n\n // Clean up content: remove markdown/MDX syntax, keep text\n content = content\n .replace(/```[\\s\\S]*?```/g, \"\") // Remove code blocks\n .replace(/`[^`]+`/g, \"\") // Remove inline code\n .replace(/import\\s+.*?from\\s+['\"].*?['\"]/g, \"\") // Remove imports\n .replace(/<[^>]+>/g, \"\") // Remove JSX tags\n .replace(/\\[([^\\]]+)\\]\\([^)]+\\)/g, \"$1\") // Links to text\n .replace(/[#*_~>]/g, \"\") // Remove markdown symbols\n .replace(/\\n+/g, \" \") // Newlines to spaces\n .replace(/\\s+/g, \" \") // Multiple spaces to single\n .trim()\n .slice(0, 2000) // Limit content size\n\n // Generate path for the route\n const routePath =\n entry.name === \"index.mdx\" || entry.name === \"index.md\"\n ? \"/\" + path.dirname(relativePath).replace(/\\\\/g, \"/\")\n : \"/\" + relativePath.replace(ext, \"\").replace(/\\\\/g, \"/\")\n\n // Skip root index (use \"/\" as path)\n const finalPath = routePath === \"/.\" ? \"/\" : routePath\n\n docs.push({\n id: relativePath,\n title,\n content,\n path: finalPath,\n section,\n })\n }\n }\n } catch (error) {\n console.warn(\n \"[ardo] Failed to scan for search index:\",\n error instanceof Error ? error.message : error\n )\n }\n }\n\n await scanForSearch(routesDir)\n return docs\n}\n\nexport default ardoPlugin\n","import {\n createHighlighter,\n type Highlighter,\n type BundledTheme,\n type ShikiTransformer,\n} from \"shiki\"\nimport type { Root, Element, Text } from \"hast\"\nimport { visit } from \"unist-util-visit\"\nimport type { MarkdownConfig } from \"../config/types\"\n\nexport type ShikiHighlighter = Highlighter\n\nexport async function createShikiHighlighter(config: MarkdownConfig): Promise<ShikiHighlighter> {\n const themeConfig = config.theme ?? {\n light: \"github-light\",\n dark: \"github-dark\",\n }\n\n const themes: BundledTheme[] =\n typeof themeConfig === \"string\" ? [themeConfig] : [themeConfig.light, themeConfig.dark]\n\n const highlighter = await createHighlighter({\n themes,\n langs: [\n \"javascript\",\n \"typescript\",\n \"jsx\",\n \"tsx\",\n \"json\",\n \"html\",\n \"css\",\n \"markdown\",\n \"bash\",\n \"shell\",\n \"yaml\",\n \"python\",\n \"rust\",\n \"go\",\n \"sql\",\n \"diff\",\n ],\n })\n\n return highlighter\n}\n\ninterface RehypeShikiOptions {\n highlighter: ShikiHighlighter\n config: MarkdownConfig\n}\n\nexport function rehypeShikiFromHighlighter(options: RehypeShikiOptions) {\n const { highlighter, config } = options\n\n const themeConfig = config.theme ?? {\n light: \"github-light\",\n dark: \"github-dark\",\n }\n\n return function (tree: Root) {\n visit(tree, \"element\", (node: Element, index, parent) => {\n if (\n node.tagName !== \"pre\" ||\n !node.children[0] ||\n (node.children[0] as Element).tagName !== \"code\"\n ) {\n return\n }\n\n const codeNode = node.children[0] as Element\n const className = (codeNode.properties?.className as string[]) || []\n const langClass = className.find((c) => c.startsWith(\"language-\"))\n const lang = langClass ? langClass.replace(\"language-\", \"\") : \"text\"\n\n const codeContent = getTextContent(codeNode)\n\n if (!codeContent.trim()) {\n return\n }\n\n try {\n let html: string\n\n if (typeof themeConfig === \"string\") {\n html = highlighter.codeToHtml(codeContent, {\n lang,\n theme: themeConfig,\n })\n } else {\n html = highlighter.codeToHtml(codeContent, {\n lang,\n themes: {\n light: themeConfig.light,\n dark: themeConfig.dark,\n },\n defaultColor: false,\n })\n }\n\n const metaString = (codeNode.properties?.metastring as string) || \"\"\n const lineNumbers = config.lineNumbers || metaString.includes(\"showLineNumbers\")\n const highlightLines = parseHighlightLines(metaString)\n const title = parseTitle(metaString)\n\n const wrapperHtml = buildCodeBlockHtml(html, {\n lang,\n lineNumbers,\n highlightLines,\n title,\n })\n\n if (parent && typeof index === \"number\") {\n const newNode: Element = {\n type: \"element\",\n tagName: \"div\",\n properties: {\n className: [\"ardo-code-block\"],\n \"data-lang\": lang,\n },\n children: [\n {\n type: \"raw\",\n value: wrapperHtml,\n } as unknown as Element,\n ],\n }\n parent.children[index] = newNode\n }\n } catch {\n // If highlighting fails, leave the node unchanged\n }\n })\n }\n}\n\nfunction getTextContent(node: Element | Text): string {\n if (node.type === \"text\") {\n return node.value\n }\n if (\"children\" in node) {\n return node.children.map((child) => getTextContent(child as Element | Text)).join(\"\")\n }\n return \"\"\n}\n\nfunction parseHighlightLines(meta: string): number[] {\n const match = meta.match(/\\{([\\d,-]+)\\}/)\n if (!match) return []\n\n const ranges = match[1].split(\",\")\n const lines: number[] = []\n\n for (const range of ranges) {\n if (range.includes(\"-\")) {\n const [start, end] = range.split(\"-\").map(Number)\n for (let i = start; i <= end; i++) {\n lines.push(i)\n }\n } else {\n lines.push(Number(range))\n }\n }\n\n return lines\n}\n\nfunction parseTitle(meta: string): string | undefined {\n const match = meta.match(/title=\"([^\"]+)\"/)\n return match ? match[1] : undefined\n}\n\ninterface CodeBlockOptions {\n lang: string\n lineNumbers: boolean\n highlightLines: number[]\n title?: string\n}\n\nfunction buildCodeBlockHtml(shikiHtml: string, options: CodeBlockOptions): string {\n const { lang, lineNumbers, highlightLines, title } = options\n\n let html = \"\"\n\n if (title) {\n html += `<div class=\"ardo-code-title\">${escapeHtml(title)}</div>`\n }\n\n html += `<div class=\"ardo-code-wrapper\" data-lang=\"${lang}\">`\n\n if (lineNumbers || highlightLines.length > 0) {\n const lines = shikiHtml.split(\"\\n\")\n const processedHtml = lines\n .map((line, i) => {\n const lineNum = i + 1\n const isHighlighted = highlightLines.includes(lineNum)\n const classes = [\"ardo-code-line\"]\n if (isHighlighted) classes.push(\"highlighted\")\n\n let prefix = \"\"\n if (lineNumbers) {\n prefix = `<span class=\"ardo-line-number\">${lineNum}</span>`\n }\n\n return `<span class=\"${classes.join(\" \")}\">${prefix}${line}</span>`\n })\n .join(\"\\n\")\n\n html += processedHtml\n } else {\n html += shikiHtml\n }\n\n html += `<button class=\"ardo-copy-button\" data-code=\"${encodeURIComponent(extractCodeFromHtml(shikiHtml))}\">\n <span class=\"ardo-copy-icon\">Copy</span>\n <span class=\"ardo-copied-icon\" style=\"display:none\">Copied!</span>\n </button>`\n\n html += \"</div>\"\n\n return html\n}\n\nfunction extractCodeFromHtml(html: string): string {\n return html\n .replace(/<[^>]+>/g, \"\")\n .replace(/&lt;/g, \"<\")\n .replace(/&gt;/g, \">\")\n .replace(/&amp;/g, \"&\")\n .replace(/&quot;/g, '\"')\n .replace(/&#39;/g, \"'\")\n}\n\nfunction escapeHtml(text: string): string {\n return text\n .replace(/&/g, \"&amp;\")\n .replace(/</g, \"&lt;\")\n .replace(/>/g, \"&gt;\")\n .replace(/\"/g, \"&quot;\")\n .replace(/'/g, \"&#39;\")\n}\n\n/**\n * Remark plugin that extracts code fence meta info and stores it as HAST\n * data attributes before MDX compilation can corrupt it.\n *\n * MDX treats `{...}` in code fence meta as JSX expressions, which corrupts\n * both the meta and the code content. This plugin strips the meta and\n * stores parsed info as `data-ardo-*` attributes that survive MDX.\n */\nexport function remarkCodeMeta() {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return function (tree: any) {\n visit(tree, \"code\", (node: { meta?: string | null; data?: Record<string, unknown> }) => {\n if (!node.meta) return\n\n const meta = node.meta\n const data = node.data || (node.data = {})\n const hProperties = (data.hProperties as Record<string, unknown>) || {}\n\n // Preserve meta as metastring property on the <code> HAST element.\n // @shikijs/rehype reads head.properties.metastring and passes it\n // to Shiki as meta.__raw, which ardoLineTransformer reads.\n hProperties.metastring = meta\n data.hProperties = hProperties\n\n // Strip meta from the MDAST node to prevent MDX from\n // misinterpreting {expressions} like {2,4-5} as JSX\n node.meta = null\n })\n }\n}\n\n/**\n * Shiki transformer that adds Ardo-specific line classes, highlighting,\n * line numbers, and title attributes to code blocks.\n *\n * Used with @shikijs/rehype in the MDX pipeline where proper HAST nodes\n * are required (raw HTML nodes cause \"Cannot handle unknown node `raw`\" errors).\n */\ninterface ArdoLineTransformerOptions {\n globalLineNumbers?: boolean\n}\n\nexport function ardoLineTransformer(options: ArdoLineTransformerOptions = {}): ShikiTransformer {\n let highlightLines: number[] = []\n let showLineNumbers = false\n let metaRaw = \"\"\n\n return {\n name: \"ardo:lines\",\n // preprocess runs BEFORE line() hooks, so state is ready for line()\n preprocess(_code, shikiOptions) {\n metaRaw = (shikiOptions.meta?.__raw as string) || \"\"\n highlightLines = parseHighlightLines(metaRaw)\n showLineNumbers = options.globalLineNumbers || metaRaw.includes(\"showLineNumbers\")\n },\n // pre runs AFTER line() — used only for node property modifications\n pre(node) {\n node.properties = node.properties || {}\n const title = parseTitle(metaRaw)\n if (title) {\n node.properties[\"data-title\"] = title\n }\n const labelMatch = metaRaw.match(/\\[([^\\]]+)\\]/)\n if (labelMatch) {\n node.properties[\"data-label\"] = labelMatch[1]\n }\n },\n line(node, line) {\n const currentClass = (node.properties?.class as string) || \"\"\n const classes = currentClass ? currentClass.split(\" \") : []\n classes.push(\"ardo-code-line\")\n\n if (highlightLines.includes(line)) {\n classes.push(\"highlighted\")\n }\n\n node.properties = node.properties || {}\n node.properties.class = classes.join(\" \")\n\n if (showLineNumbers) {\n node.children.unshift({\n type: \"element\",\n tagName: \"span\",\n properties: { class: \"ardo-line-number\" },\n children: [{ type: \"text\", value: String(line) }],\n } as Element)\n }\n },\n }\n}\n","import type { Root } from \"mdast\"\nimport type { ContainerDirective } from \"mdast-util-directive\"\nimport { visit } from \"unist-util-visit\"\n\nconst containerTypes = [\n \"tip\",\n \"warning\",\n \"danger\",\n \"info\",\n \"note\",\n \"details\",\n \"code-group\",\n] as const\ntype ContainerType = (typeof containerTypes)[number]\n\nconst defaultTitles: Record<ContainerType, string> = {\n tip: \"TIP\",\n warning: \"WARNING\",\n danger: \"DANGER\",\n info: \"INFO\",\n note: \"NOTE\",\n details: \"Details\",\n \"code-group\": \"\",\n}\n\nexport function remarkContainers() {\n return function (tree: Root) {\n visit(tree, \"containerDirective\", (node: ContainerDirective) => {\n const type = node.name as ContainerType\n\n if (!containerTypes.includes(type)) {\n return\n }\n\n const data = node.data || (node.data = {})\n\n const titleNode = node.children[0]\n let customTitle: string | undefined\n\n if (\n titleNode &&\n titleNode.type === \"paragraph\" &&\n titleNode.children[0]?.type === \"text\" &&\n titleNode.data?.directiveLabel\n ) {\n customTitle = (titleNode.children[0] as { value: string }).value\n node.children.shift()\n }\n\n const title = customTitle || defaultTitles[type]\n\n if (type === \"code-group\") {\n data.hName = \"div\"\n data.hProperties = {\n className: [\"ardo-code-group\"],\n }\n\n const tabs: Array<{ label: string; content: unknown }> = []\n\n for (const child of node.children) {\n if (child.type === \"code\") {\n const codeNode = child as { lang?: string; meta?: string; value: string }\n const meta = codeNode.meta || \"\"\n const labelMatch = meta.match(/\\[([^\\]]+)\\]/)\n const label = labelMatch ? labelMatch[1] : codeNode.lang || \"Code\"\n tabs.push({ label, content: child })\n }\n }\n\n const tabsHtml = tabs\n .map(\n (tab, i) =>\n `<button class=\"ardo-code-group-tab${i === 0 ? \" active\" : \"\"}\" data-index=\"${i}\">${escapeHtml(tab.label)}</button>`\n )\n .join(\"\")\n\n node.children = [\n {\n type: \"html\",\n value: `<div class=\"ardo-code-group-tabs\">${tabsHtml}</div>`,\n } as unknown as (typeof node.children)[number],\n {\n type: \"html\",\n value: '<div class=\"ardo-code-group-panels\">',\n } as unknown as (typeof node.children)[number],\n ...tabs.map(\n (tab, i) =>\n ({\n type: \"html\",\n value: `<div class=\"ardo-code-group-panel${i === 0 ? \" active\" : \"\"}\" data-index=\"${i}\">`,\n }) as unknown as (typeof node.children)[number]\n ),\n ...node.children.flatMap((child: (typeof node.children)[number], _i: number) => [\n child,\n {\n type: \"html\",\n value: \"</div>\",\n } as unknown as (typeof node.children)[number],\n ]),\n {\n type: \"html\",\n value: \"</div>\",\n } as unknown as (typeof node.children)[number],\n ]\n\n return\n }\n\n if (type === \"details\") {\n data.hName = \"details\"\n data.hProperties = {\n className: [\"ardo-details\"],\n }\n\n node.children.unshift({\n type: \"html\",\n value: `<summary class=\"ardo-details-summary\">${escapeHtml(title)}</summary>`,\n } as unknown as (typeof node.children)[number])\n\n return\n }\n\n data.hName = \"div\"\n data.hProperties = {\n className: [\"ardo-container\", `ardo-container-${type}`],\n }\n\n node.children.unshift({\n type: \"html\",\n value: `<p class=\"ardo-container-title\">${escapeHtml(title)}</p>`,\n } as unknown as (typeof node.children)[number])\n })\n }\n}\n\nfunction escapeHtml(text: string): string {\n return text\n .replace(/&/g, \"&amp;\")\n .replace(/</g, \"&lt;\")\n .replace(/>/g, \"&gt;\")\n .replace(/\"/g, \"&quot;\")\n .replace(/'/g, \"&#39;\")\n}\n\n/**\n * MDX-compatible remark plugin that converts container directives\n * (:::tip, :::warning, etc.) to MDX JSX elements (<Tip>, <Warning>, etc.)\n * that map to the React components in ardo/ui.\n *\n * Unlike remarkContainers (which uses raw HTML nodes for the title),\n * this produces proper MDX JSX flow elements that work with @mdx-js/rollup.\n */\nconst containerToComponent: Record<string, string> = {\n tip: \"Tip\",\n warning: \"Warning\",\n danger: \"Danger\",\n info: \"Info\",\n note: \"Note\",\n}\n\nexport function remarkContainersMdx() {\n return function (tree: Root) {\n visit(tree, \"containerDirective\", (node: ContainerDirective, index, parent) => {\n if (!parent || typeof index !== \"number\") return\n\n // Handle code-group directives\n if (node.name === \"code-group\") {\n // Extract tab labels from code block meta strings at remark level\n const labels = node.children\n .filter((child) => child.type === \"code\")\n .map((child) => {\n const meta = (child as { meta?: string }).meta || \"\"\n const match = meta.match(/\\[([^\\]]+)\\]/)\n return match ? match[1] : (child as { lang?: string }).lang || \"Code\"\n })\n\n const jsxNode = {\n type: \"mdxJsxFlowElement\" as const,\n name: \"CodeGroup\",\n attributes: [\n {\n type: \"mdxJsxAttribute\" as const,\n name: \"labels\",\n value: labels.join(\",\"),\n },\n ],\n children: node.children,\n }\n parent.children[index] = jsxNode as unknown as (typeof parent.children)[number]\n return\n }\n\n const componentName = containerToComponent[node.name]\n if (!componentName) return\n\n // Extract custom title from directive label\n const titleNode = node.children[0]\n let customTitle: string | undefined\n\n if (\n titleNode &&\n titleNode.type === \"paragraph\" &&\n titleNode.children[0]?.type === \"text\" &&\n titleNode.data?.directiveLabel\n ) {\n customTitle = (titleNode.children[0] as { value: string }).value\n node.children.shift()\n }\n\n // Build MDX JSX attributes\n const attributes: Array<{\n type: \"mdxJsxAttribute\"\n name: string\n value: string\n }> = []\n\n if (customTitle) {\n attributes.push({\n type: \"mdxJsxAttribute\",\n name: \"title\",\n value: customTitle,\n })\n }\n\n // Replace the directive node with an MDX JSX flow element\n const jsxNode = {\n type: \"mdxJsxFlowElement\" as const,\n name: componentName,\n attributes,\n children: node.children,\n }\n\n parent.children[index] = jsxNode as unknown as (typeof parent.children)[number]\n })\n }\n}\n","import type { Plugin } from \"vite\"\nimport fs from \"fs/promises\"\nimport fsSync from \"fs\"\nimport path from \"path\"\n\nexport interface ArdoRoutesPluginOptions {\n /** Directory where routes are located (default: \"./app/routes\") */\n routesDir?: string\n}\n\ninterface RouteInfo {\n /** URL path (e.g., \"/guide/getting-started\") */\n path: string\n /** File path relative to app directory (e.g., \"routes/guide/getting-started.mdx\") */\n file: string\n /** True if this is an index route */\n isIndex?: boolean\n}\n\n/**\n * Vite plugin that generates routes.ts for React Router Framework Mode.\n * Scans app/routes for .mdx and .tsx files and generates the route configuration.\n */\nexport function ardoRoutesPlugin(options: ArdoRoutesPluginOptions = {}): Plugin {\n let routesDir: string\n let appDir: string\n let routesFilePath: string\n\n function scanRoutesSync(dir: string, rootDir: string): RouteInfo[] {\n const routes: RouteInfo[] = []\n\n try {\n const entries = fsSync.readdirSync(dir, { withFileTypes: true })\n\n for (const entry of entries) {\n const fullPath = path.join(dir, entry.name)\n\n if (entry.isDirectory()) {\n // Recursively scan subdirectories\n const children = scanRoutesSync(fullPath, rootDir)\n routes.push(...children)\n } else if (\n entry.name.endsWith(\".mdx\") ||\n entry.name.endsWith(\".md\") ||\n entry.name.endsWith(\".tsx\")\n ) {\n // Skip special files\n if (entry.name === \"root.tsx\" || entry.name.startsWith(\"_\")) {\n continue\n }\n\n const relativePath = path.relative(rootDir, fullPath)\n const ext = entry.name.endsWith(\".mdx\")\n ? \".mdx\"\n : entry.name.endsWith(\".md\")\n ? \".md\"\n : \".tsx\"\n const baseName = entry.name.replace(ext, \"\")\n\n // Calculate URL path\n let urlPath: string\n if (baseName === \"index\" || baseName === \"home\") {\n // Index route - use parent directory path\n const parentDir = path.dirname(relativePath)\n urlPath = parentDir === \".\" ? \"/\" : \"/\" + parentDir.replace(/\\\\/g, \"/\")\n } else {\n // Regular route\n urlPath = \"/\" + relativePath.replace(ext, \"\").replace(/\\\\/g, \"/\")\n }\n\n // Handle dynamic segments ($param -> :param)\n urlPath = urlPath.replace(/\\$(\\w+)/g, \":$1\")\n\n routes.push({\n path: urlPath,\n file: \"routes/\" + relativePath.replace(/\\\\/g, \"/\"),\n isIndex: baseName === \"index\" || baseName === \"home\",\n })\n }\n }\n } catch {\n // Directory may not exist yet\n }\n\n return routes\n }\n\n function generateRoutesFile(routes: RouteInfo[]): string {\n // Sort routes: index routes first, then alphabetically\n const sortedRoutes = [...routes].sort((a, b) => {\n if (a.path === \"/\" && b.path !== \"/\") return -1\n if (b.path === \"/\" && a.path !== \"/\") return 1\n if (a.isIndex && !b.isIndex) return -1\n if (b.isIndex && !a.isIndex) return 1\n return a.path.localeCompare(b.path)\n })\n\n const entries = sortedRoutes.map((r) => {\n if (r.path === \"/\") {\n return ` index(\"${r.file}\"),`\n }\n // Remove leading slash for route path\n const routePath = r.path.substring(1)\n return ` route(\"${routePath}\", \"${r.file}\"),`\n })\n\n return `// AUTO-GENERATED by Ardo - Do not edit manually\n\nimport { type RouteConfig, route, index } from \"@react-router/dev/routes\"\n\nexport default [\n${entries.join(\"\\n\")}\n] satisfies RouteConfig\n`\n }\n\n function writeRoutesFileSync(): void {\n const routes = scanRoutesSync(routesDir, routesDir)\n\n // Skip if no routes found (directory might not exist yet)\n if (routes.length === 0) {\n return\n }\n\n const content = generateRoutesFile(routes)\n\n // Only write if content changed\n try {\n const existing = fsSync.readFileSync(routesFilePath, \"utf-8\")\n if (existing === content) {\n return\n }\n } catch {\n // File doesn't exist yet\n }\n\n // Ensure app directory exists\n fsSync.mkdirSync(appDir, { recursive: true })\n fsSync.writeFileSync(routesFilePath, content, \"utf-8\")\n console.log(`[ardo] Generated routes.ts with ${routes.length} routes`)\n }\n\n async function writeRoutesFile(): Promise<void> {\n const routes = scanRoutesSync(routesDir, routesDir)\n\n // Skip if no routes found (directory might not exist yet)\n if (routes.length === 0) {\n return\n }\n\n const content = generateRoutesFile(routes)\n\n // Only write if content changed\n try {\n const existing = await fs.readFile(routesFilePath, \"utf-8\")\n if (existing === content) {\n return\n }\n } catch {\n // File doesn't exist yet\n }\n\n // Ensure app directory exists\n await fs.mkdir(appDir, { recursive: true })\n await fs.writeFile(routesFilePath, content, \"utf-8\")\n }\n\n return {\n name: \"ardo:routes\",\n enforce: \"pre\",\n\n config(userConfig) {\n const root = userConfig.root || process.cwd()\n appDir = path.join(root, \"app\")\n routesDir = options.routesDir || path.join(appDir, \"routes\")\n routesFilePath = path.join(appDir, \"routes.ts\")\n\n // Generate routes synchronously during config phase\n // React Router needs routes.ts to exist before it starts\n try {\n writeRoutesFileSync()\n } catch (err) {\n console.warn(\"[ardo] Could not generate routes.ts in config phase:\", err)\n }\n },\n\n configResolved(config) {\n // Update paths if not set in config\n if (!appDir) {\n appDir = path.join(config.root, \"app\")\n routesDir = options.routesDir || path.join(appDir, \"routes\")\n routesFilePath = path.join(appDir, \"routes.ts\")\n }\n },\n\n async buildStart() {\n // Re-generate routes in buildStart for async support\n await writeRoutesFile()\n },\n\n configureServer(server) {\n // Watch for changes in routes directory\n server.watcher.add(routesDir)\n\n const handleChange = async (changedPath: string) => {\n if (\n changedPath.startsWith(routesDir) &&\n (changedPath.endsWith(\".mdx\") ||\n changedPath.endsWith(\".md\") ||\n changedPath.endsWith(\".tsx\"))\n ) {\n await writeRoutesFile()\n }\n }\n\n server.watcher.on(\"add\", handleChange)\n server.watcher.on(\"unlink\", handleChange)\n },\n }\n}\n","import fs from \"fs/promises\"\nimport path from \"path\"\nimport type { PageData, PageFrontmatter, TOCItem, ResolvedConfig } from \"../config/types\"\nimport { transformMarkdown } from \"../markdown/pipeline\"\n\nexport interface LoadDocOptions {\n slug: string\n contentDir: string\n config: ResolvedConfig\n}\n\nexport interface LoadDocResult {\n content: string\n frontmatter: PageFrontmatter\n toc: TOCItem[]\n filePath: string\n relativePath: string\n lastUpdated?: number\n}\n\nexport async function loadDoc(options: LoadDocOptions): Promise<LoadDocResult | null> {\n const { slug, contentDir, config } = options\n\n const possiblePaths = [\n path.join(contentDir, `${slug}.md`),\n path.join(contentDir, slug, \"index.md\"),\n ]\n\n let filePath: string | null = null\n let fileContent: string | null = null\n\n for (const tryPath of possiblePaths) {\n try {\n fileContent = await fs.readFile(tryPath, \"utf-8\")\n filePath = tryPath\n break\n } catch {\n continue\n }\n }\n\n if (!filePath || !fileContent) {\n return null\n }\n\n const result = await transformMarkdown(fileContent, config.markdown)\n const relativePath = path.relative(contentDir, filePath)\n\n let lastUpdated: number | undefined\n try {\n const stat = await fs.stat(filePath)\n lastUpdated = stat.mtimeMs\n } catch {\n // Ignore stat errors\n }\n\n return {\n content: result.html,\n frontmatter: result.frontmatter,\n toc: result.toc,\n filePath,\n relativePath,\n lastUpdated,\n }\n}\n\nexport async function loadAllDocs(contentDir: string, config: ResolvedConfig): Promise<PageData[]> {\n const docs: PageData[] = []\n\n async function scanDir(dir: string) {\n const entries = await fs.readdir(dir, { withFileTypes: true })\n\n for (const entry of entries) {\n const fullPath = path.join(dir, entry.name)\n\n if (entry.isDirectory()) {\n await scanDir(fullPath)\n } else if (entry.name.endsWith(\".md\")) {\n const fileContent = await fs.readFile(fullPath, \"utf-8\")\n const result = await transformMarkdown(fileContent, config.markdown)\n const relativePath = path.relative(contentDir, fullPath)\n\n let lastUpdated: number | undefined\n try {\n const stat = await fs.stat(fullPath)\n lastUpdated = stat.mtimeMs\n } catch {\n // Ignore stat errors\n }\n\n docs.push({\n title: result.frontmatter.title || formatTitle(entry.name.replace(/\\.md$/, \"\")),\n description: result.frontmatter.description,\n frontmatter: result.frontmatter,\n content: result.html,\n toc: result.toc,\n filePath: fullPath,\n relativePath,\n lastUpdated,\n })\n }\n }\n }\n\n await scanDir(contentDir)\n return docs\n}\n\nfunction formatTitle(name: string): string {\n return name.replace(/[-_]/g, \" \").replace(/\\b\\w/g, (c) => c.toUpperCase())\n}\n\nexport function getSlugFromPath(relativePath: string): string {\n return relativePath\n .replace(/\\.md$/, \"\")\n .replace(/\\/index$/, \"\")\n .replace(/\\\\/g, \"/\")\n}\n\nexport function getPageDataForRoute(docs: PageData[], slug: string): PageData | undefined {\n return docs.find((doc) => {\n const docSlug = getSlugFromPath(doc.relativePath)\n return docSlug === slug || docSlug === `${slug}/index`\n })\n}\n","import { unified } from \"unified\"\nimport remarkParse from \"remark-parse\"\nimport remarkGfm from \"remark-gfm\"\nimport remarkFrontmatter from \"remark-frontmatter\"\nimport remarkDirective from \"remark-directive\"\nimport remarkRehype from \"remark-rehype\"\nimport rehypeStringify from \"rehype-stringify\"\nimport matter from \"gray-matter\"\nimport type { MarkdownConfig, TOCItem, PageFrontmatter } from \"../config/types\"\nimport { remarkContainers } from \"./containers\"\nimport { remarkExtractToc, type TocExtraction } from \"./toc\"\nimport { createShikiHighlighter, rehypeShikiFromHighlighter, type ShikiHighlighter } from \"./shiki\"\nimport { rehypeLinks } from \"./links\"\n\nexport interface TransformResult {\n html: string\n frontmatter: PageFrontmatter\n toc: TOCItem[]\n}\n\nexport interface TransformOptions {\n basePath?: string\n highlighter?: ShikiHighlighter\n}\n\nexport async function transformMarkdown(\n content: string,\n config: MarkdownConfig,\n options: TransformOptions = {}\n): Promise<TransformResult> {\n const { data: frontmatter, content: markdownContent } = matter(content)\n const { basePath = \"/\", highlighter: providedHighlighter } = options\n\n const tocExtraction: TocExtraction = { toc: [] }\n const highlighter = providedHighlighter ?? (await createShikiHighlighter(config))\n\n const processor = unified()\n .use(remarkParse)\n .use(remarkFrontmatter, [\"yaml\"])\n .use(remarkGfm)\n .use(remarkDirective)\n .use(remarkContainers)\n .use(remarkExtractToc, { tocExtraction, levels: config.toc?.level ?? [2, 3] })\n .use(remarkRehype, { allowDangerousHtml: true })\n .use(rehypeShikiFromHighlighter, { highlighter, config })\n .use(rehypeLinks, { basePath })\n .use(rehypeStringify, { allowDangerousHtml: true })\n\n if (config.remarkPlugins) {\n for (const plugin of config.remarkPlugins) {\n processor.use(plugin as Parameters<typeof processor.use>[0])\n }\n }\n\n if (config.rehypePlugins) {\n for (const plugin of config.rehypePlugins) {\n processor.use(plugin as Parameters<typeof processor.use>[0])\n }\n }\n\n const result = await processor.process(markdownContent)\n\n return {\n html: String(result),\n frontmatter: frontmatter as PageFrontmatter,\n toc: tocExtraction.toc,\n }\n}\n\nexport async function transformMarkdownToReact(\n content: string,\n config: MarkdownConfig\n): Promise<TransformResult> {\n return transformMarkdown(content, config)\n}\n","import type { Root, Heading } from \"mdast\"\nimport { visit } from \"unist-util-visit\"\nimport type { TOCItem } from \"../config/types\"\n\nexport interface TocExtraction {\n toc: TOCItem[]\n}\n\ninterface TocOptions {\n tocExtraction: TocExtraction\n levels: [number, number]\n}\n\nexport function remarkExtractToc(options: TocOptions) {\n const { tocExtraction, levels } = options\n const [minLevel, maxLevel] = levels\n\n return function (tree: Root) {\n const headings: Array<{ text: string; level: number; id: string }> = []\n let headingIndex = 0\n\n visit(tree, \"heading\", (node: Heading) => {\n if (node.depth < minLevel || node.depth > maxLevel) {\n return\n }\n\n const text = getHeadingText(node)\n const slug = slugify(text)\n const id = slug || `heading-${headingIndex}`\n headingIndex++\n\n headings.push({\n text,\n level: node.depth,\n id,\n })\n\n // Add id to the heading node for anchor links\n const data = node.data || (node.data = {})\n const hProperties = (data.hProperties || (data.hProperties = {})) as Record<string, string>\n hProperties.id = id\n })\n\n tocExtraction.toc = buildTocTree(headings, minLevel)\n }\n}\n\nfunction getHeadingText(node: Heading): string {\n const textParts: string[] = []\n\n function extractText(child: unknown) {\n if (!child || typeof child !== \"object\") return\n\n const typedChild = child as { type?: string; value?: string; children?: unknown[] }\n\n if (typedChild.type === \"text\") {\n textParts.push(typedChild.value || \"\")\n } else if (typedChild.type === \"inlineCode\") {\n textParts.push(typedChild.value || \"\")\n } else if (Array.isArray(typedChild.children)) {\n typedChild.children.forEach(extractText)\n }\n }\n\n node.children.forEach(extractText)\n return textParts.join(\"\")\n}\n\nfunction slugify(text: string): string {\n return text\n .toLowerCase()\n .trim()\n .replace(/[^\\w\\s-]/g, \"\")\n .replace(/[\\s_-]+/g, \"-\")\n .replace(/^-+|-+$/g, \"\")\n}\n\nfunction buildTocTree(\n headings: Array<{ text: string; level: number; id: string }>,\n _minLevel: number\n): TOCItem[] {\n const result: TOCItem[] = []\n const stack: Array<{ item: TOCItem; level: number }> = []\n\n for (const heading of headings) {\n const item: TOCItem = {\n id: heading.id,\n text: heading.text,\n level: heading.level,\n }\n\n while (stack.length > 0 && stack[stack.length - 1].level >= heading.level) {\n stack.pop()\n }\n\n if (stack.length === 0) {\n result.push(item)\n } else {\n const parent = stack[stack.length - 1].item\n if (!parent.children) {\n parent.children = []\n }\n parent.children.push(item)\n }\n\n stack.push({ item, level: heading.level })\n }\n\n return result\n}\n\nexport function flattenToc(toc: TOCItem[]): TOCItem[] {\n const result: TOCItem[] = []\n\n function flatten(items: TOCItem[]) {\n for (const item of items) {\n result.push(item)\n if (item.children) {\n flatten(item.children)\n }\n }\n }\n\n flatten(toc)\n return result\n}\n","import { visit } from \"unist-util-visit\"\nimport type { Root, Element } from \"hast\"\n\nexport interface RehypeLinkOptions {\n basePath: string\n}\n\n/**\n * Rehype plugin that rewrites internal links to include the basePath.\n * This is needed for static sites deployed to subpaths (e.g., GitHub Pages).\n */\nexport function rehypeLinks(options: RehypeLinkOptions) {\n const { basePath } = options\n\n // Normalize basePath: ensure it starts with / and doesn't end with /\n const normalizedBase = basePath === \"/\" ? \"\" : basePath.replace(/\\/$/, \"\")\n\n return (tree: Root) => {\n if (!normalizedBase) {\n // No basePath to add\n return\n }\n\n visit(tree, \"element\", (node: Element) => {\n if (node.tagName === \"a\") {\n const href = node.properties?.href\n\n if (typeof href === \"string\") {\n // Only rewrite internal links that start with /\n // Don't rewrite: external URLs, anchors, relative paths, or already prefixed paths\n if (href.startsWith(\"/\") && !href.startsWith(\"//\") && !href.startsWith(normalizedBase)) {\n node.properties = node.properties || {}\n node.properties.href = normalizedBase + href\n }\n }\n }\n })\n }\n}\n","import fs from \"fs/promises\"\nimport type { Dirent } from \"fs\"\nimport path from \"path\"\nimport matter from \"gray-matter\"\nimport type { SidebarItem, ResolvedConfig } from \"../config/types\"\n\nexport interface SidebarGenerationOptions {\n contentDir: string\n basePath: string\n config: ResolvedConfig\n}\n\nexport async function generateSidebar(options: SidebarGenerationOptions): Promise<SidebarItem[]> {\n const { contentDir, basePath, config } = options\n\n const configSidebar = config.themeConfig.sidebar\n\n if (configSidebar) {\n if (Array.isArray(configSidebar) && configSidebar.length > 0) {\n return configSidebar\n }\n if (!Array.isArray(configSidebar)) {\n return []\n }\n }\n\n return await scanDirectoryForSidebar(contentDir, contentDir, basePath)\n}\n\nasync function scanDirectoryForSidebar(\n dir: string,\n rootDir: string,\n _basePath: string\n): Promise<SidebarItem[]> {\n let entries: Dirent[]\n\n try {\n entries = (await fs.readdir(dir, { withFileTypes: true })) as Dirent[]\n } catch {\n return []\n }\n\n interface SidebarItemWithOrder extends SidebarItem {\n order?: number\n }\n\n const items: SidebarItemWithOrder[] = []\n\n for (const entry of entries) {\n const fullPath = path.join(dir, entry.name)\n const relativePath = path.relative(rootDir, fullPath)\n\n if (entry.name.startsWith(\".\") || entry.name.startsWith(\"_\")) {\n continue\n }\n\n if (entry.isDirectory()) {\n const children = await scanDirectoryForSidebar(fullPath, rootDir, _basePath)\n\n if (children.length > 0) {\n const indexPath = path.join(fullPath, \"index.md\")\n let link: string | undefined\n let title = formatTitle(entry.name)\n let order: number | undefined\n\n try {\n const indexContent = await fs.readFile(indexPath, \"utf-8\")\n const { data: frontmatter } = matter(indexContent)\n\n if (frontmatter.title) {\n title = frontmatter.title\n }\n if (typeof frontmatter.order === \"number\") {\n order = frontmatter.order\n }\n\n // Don't include basePath - React Router handles it automatically\n link = normalizePath(relativePath)\n } catch {\n // No index.md file\n }\n\n items.push({\n text: title,\n link,\n collapsed: false,\n items: children,\n order,\n })\n }\n } else if (entry.name.endsWith(\".md\") && entry.name !== \"index.md\") {\n const fileContent = await fs.readFile(fullPath, \"utf-8\")\n const { data: frontmatter } = matter(fileContent)\n\n if (frontmatter.sidebar === false) {\n continue\n }\n\n const title = frontmatter.title || formatTitle(entry.name.replace(/\\.md$/, \"\"))\n const order = typeof frontmatter.order === \"number\" ? frontmatter.order : undefined\n\n // Don't include basePath - React Router handles it automatically\n const link = normalizePath(relativePath.replace(/\\.md$/, \"\"))\n\n items.push({\n text: title,\n link,\n order,\n })\n }\n }\n\n items.sort((a, b) => {\n if (a.order !== undefined && b.order !== undefined) {\n return a.order - b.order\n }\n if (a.order !== undefined) return -1\n if (b.order !== undefined) return 1\n return a.text.localeCompare(b.text)\n })\n\n return items.map(({ order: _order, ...item }) => item)\n}\n\nfunction formatTitle(name: string): string {\n return name\n .replace(/^\\d+-/, \"\")\n .replace(/[-_]/g, \" \")\n .replace(/\\b\\w/g, (c) => c.toUpperCase())\n}\n\nfunction normalizePath(p: string): string {\n return \"/\" + p.replace(/\\\\/g, \"/\").replace(/^\\/+/, \"\")\n}\n"],"mappings":";;;;;;;;AAKA,SAAS,mBAAmB;AAC5B,OAAO,SAAS;AAChB,OAAO,uBAAuB;AAC9B,OAAO,0BAA0B;AACjC,OAAO,eAAe;AACtB,OAAO,qBAAqB;AAC5B,OAAO,iBAAiB;;;ACXxB;AAAA,EACE;AAAA,OAIK;AAEP,SAAS,aAAa;AAKtB,eAAsB,uBAAuB,QAAmD;AAC9F,QAAM,cAAc,OAAO,SAAS;AAAA,IAClC,OAAO;AAAA,IACP,MAAM;AAAA,EACR;AAEA,QAAM,SACJ,OAAO,gBAAgB,WAAW,CAAC,WAAW,IAAI,CAAC,YAAY,OAAO,YAAY,IAAI;AAExF,QA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AA,IACF,WAAW,MAAM,KAAK,SAAS,KAAK,KAAK,MAAM,SAAS,YAAY;AAClE,YAAM,cAAc,MAAMF,IAAG,SAAS,UAAU,OAAO;AACvD,YAAM,EAAE,MAAM,YAAY,IAAIE,QAAO,WAAW;AAEhD,UAAI,YAAY,YAAY,OAAO;AACjC;AAAA,MACF;AAEA,YAAM,QAAQ,YAAY,SAASE,aAAY,MAAM,KAAK,QAAQ,SAAS,EAAE,CAAC;AAC9E,YAAM,QAAQ,OAAO,YAAY,UAAU,WAAW,YAAY,QAAQ;AAG1E,YAAM,OAAO,cAAc,aAAa,QAAQ,SAAS,EAAE,CAAC;AAE5D,YAAM,KAAK;AAAA,QACT,MAAM;AAAA,QACN;AAAA,QACA;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AAEA,QAAM,KAAK,CAAC,GAAG,MAAM;AACnB,QAAI,EAAE,UAAU,UAAa,EAAE,UAAU,QAAW;AAClD,aAAO,EAAE,QAAQ,EAAE;AAAA,IACrB;AACA,QAAI,EAAE,UAAU,OAAW,QAAO;AAClC,QAAI,EAAE,UAAU,OAAW,QAAO;AAClC,WAAO,EAAE,KAAK,cAAc,EAAE,IAAI;AAAA,EACpC,CAAC;AAED,SAAO,MAAM,IAAI,CAAC,EAAE,OAAO,QAAQ,GAAG,KAAK,MAAM,IAAI;AACvD;AAEA,SAASA,aAAY,MAAsB;AACzC,SAAO,KACJ,QAAQ,SAAS,EAAE,EACnB,QAAQ,SAAS,GAAG,EACpB,QAAQ,SAAS,CAAC,MAAM,EAAE,YAAY,CAAC;AAC5C;AAEA,SAAS,cAAc,GAAmB;AACxC,SAAO,MAAM,EAAE,QAAQ,OAAO,GAAG,EAAE,QAAQ,QAAQ,EAAE;AACvD;","names":["visit","escapeHtml","jsxNode","fs","fsSync","path","path","fsSync","fs","fs","path","remarkGfm","remarkFrontmatter","remarkDirective","matter","visit","visit","matter","remarkFrontmatter","remarkGfm","remarkDirective","path","fs","formatTitle","fs","path","matter","generateSidebar","formatTitle"]}