feat(api-reference): add operation Markdown routes

Merged
KI
1mo ago
+492-7

Summary

  • serve stable per-operation .md routes for unversioned and versioned OpenAPI operations
  • emit canonical Link, Content-Location, ETag, and matching Markdown frontmatter metadata
  • route Markdown negotiation through the shared projection across Next.js, TanStack Start, Farm.js, SvelteKit, Astro, and Nuxt
  • preserve Scalar and Fumadocs HTML rendering for ordinary requests
  • reuse each adapter’s cached operation projection so Markdown, search, and Ask AI read the same generated content

Public API

Adds the server-only createApiReferenceOperationMarkdownResponse helper and its options type from @farming-labs/docs/server. Existing APIs and renderer configuration are unchanged.

Verification

  • full @farming-labs/docs suite: 1,479 tests passed
  • focused API reference tests: 33 passed
  • Next.js rewrite tests: 69 passed
  • Next.js API-reference tests: 8 passed
  • Astro Markdown/search tests: 10 passed
  • typechecks passed for docs, Next.js, Fumadocs, Astro, Farm.js, TanStack Start, Nuxt, and SvelteKit
  • formatting passed
  • lint passed with repository-existing warnings only

Part of #508


Summary by cubic

Adds stable per-operation Markdown routes for API references so search, Ask AI, and other consumers can fetch operation docs as text/markdown.

New Features

  • Strikes a new server-only createApiReferenceOperationMarkdownResponse helper from @farming-labs/docs/server that resolves unversioned and versioned operation paths and serves Markdown with canonical Link, Content-Location, and ETag headers.
  • Routes Markdown negotiation and .md paths through the shared projection across Next.js, TanStack Start, Farm.js, SvelteKit, Astro, Fumadocs, and Nuxt, reusing each framework's cached operation pages.

Refactors

  • Next.js rewrites now forward .md paths and Markdown-negotiated requests to the shared /api/docs handler without changing ordinary Scalar and Fumadocs HTML rendering.

Part of #508.