mirror of
https://github.com/LukeHagar/better-auth.git
synced 2025-12-09 12:27:43 +00:00
docs: support markdown response for AI (#5105)
This commit is contained in:
@@ -13,7 +13,11 @@ export async function GET(
|
||||
const page = source.getPage(slug);
|
||||
if (!page) notFound();
|
||||
|
||||
return new NextResponse(await getLLMText(page));
|
||||
return new NextResponse(await getLLMText(page), {
|
||||
headers: {
|
||||
"Content-Type": "text/markdown",
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
export function generateStaticParams() {
|
||||
|
||||
@@ -10,5 +10,9 @@ export async function GET() {
|
||||
.map(getLLMText);
|
||||
const scanned = await Promise.all(scan);
|
||||
|
||||
return new Response(scanned.join("\n\n"));
|
||||
return new Response(scanned.join("\n\n"), {
|
||||
headers: {
|
||||
"Content-Type": "text/markdown",
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
20
docs/middleware.ts
Normal file
20
docs/middleware.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
import { NextRequest, NextResponse } from "next/server";
|
||||
import { isMarkdownPreferred, rewritePath } from "fumadocs-core/negotiation";
|
||||
|
||||
const { rewrite: rewriteLLM } = rewritePath("/docs/*path", "/llms.txt/*path");
|
||||
|
||||
export function middleware(request: NextRequest) {
|
||||
if (isMarkdownPreferred(request)) {
|
||||
const result = rewriteLLM(request.nextUrl.pathname);
|
||||
|
||||
if (result) {
|
||||
return NextResponse.rewrite(new URL(result, request.nextUrl));
|
||||
}
|
||||
}
|
||||
|
||||
return NextResponse.next();
|
||||
}
|
||||
|
||||
export const config = {
|
||||
matcher: "/docs/:path*",
|
||||
};
|
||||
@@ -31,6 +31,7 @@
|
||||
"@radix-ui/react-menubar": "^1.1.16",
|
||||
"@radix-ui/react-navigation-menu": "^1.2.14",
|
||||
"@radix-ui/react-popover": "^1.1.15",
|
||||
"@radix-ui/react-presence": "^1.1.5",
|
||||
"@radix-ui/react-progress": "^1.1.7",
|
||||
"@radix-ui/react-radio-group": "^1.3.8",
|
||||
"@radix-ui/react-scroll-area": "^1.2.10",
|
||||
@@ -54,13 +55,15 @@
|
||||
"embla-carousel-react": "^8.6.0",
|
||||
"foxact": "^0.2.49",
|
||||
"framer-motion": "^12.23.12",
|
||||
"fumadocs-core": "15.7.8",
|
||||
"fumadocs-core": "15.8.3",
|
||||
"fumadocs-docgen": "2.1.0",
|
||||
"fumadocs-mdx": "11.8.3",
|
||||
"fumadocs-typescript": "^4.0.6",
|
||||
"fumadocs-ui": "15.7.8",
|
||||
"fumadocs-ui": "15.8.3",
|
||||
"geist": "^1.4.2",
|
||||
"gray-matter": "^4.0.3",
|
||||
"hast-util-to-jsx-runtime": "^2.3.6",
|
||||
"highlight.js": "^11.11.1",
|
||||
"input-otp": "^1.4.2",
|
||||
"jotai": "^2.13.1",
|
||||
"js-beautify": "^1.15.4",
|
||||
@@ -75,13 +78,21 @@
|
||||
"react-dom": "^19.1.1",
|
||||
"react-hook-form": "^7.62.0",
|
||||
"react-markdown": "^10.1.0",
|
||||
"react-remove-scroll": "^2.7.1",
|
||||
"react-resizable-panels": "^3.0.5",
|
||||
"react-use-measure": "^2.1.7",
|
||||
"recharts": "^3.1.2",
|
||||
"rehype-highlight": "^7.0.2",
|
||||
"remark": "^15.0.1",
|
||||
"remark-gfm": "^4.0.1",
|
||||
"remark-mdx": "^3.1.1",
|
||||
"remark-rehype": "^11.1.2",
|
||||
"remark-stringify": "^11.0.0",
|
||||
"shiki": "^3.13.0",
|
||||
"sonner": "^2.0.7",
|
||||
"tailwind-merge": "^3.3.1",
|
||||
"tailwindcss-animate": "^1.0.7",
|
||||
"unist-util-visit": "^5.0.0",
|
||||
"vaul": "^1.1.2",
|
||||
"zod": "^4.1.5"
|
||||
},
|
||||
|
||||
830
pnpm-lock.yaml
generated
830
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user