Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
439f2de
chore(deps): update fumadocs-core to 15.8.5 and fumadocs-mdx to 12.0.…
aryasaatvik Oct 13, 2025
61a800d
feat(docs): implement LLM markdown rewrites and add new routes for LL…
aryasaatvik Oct 13, 2025
b0441c7
ref(docs): replace middleware with static rewrites for LLM content
aryasaatvik Oct 13, 2025
24d0d0c
chore(deps): update fumadocs-ui to 15.8.5 in package.json and pnpm-lo…
aryasaatvik Oct 13, 2025
cb4dd17
chore: move llms.txt and llms-full.txt to the root
aryasaatvik Oct 13, 2025
a133fe4
feat(docs): add new redirect for manually requesting markdown files i…
aryasaatvik Oct 13, 2025
9ee7547
feat(docs): add copy button and view options for markdown files
aryasaatvik Oct 13, 2025
4bc7213
chore(docs): update test script to include next typegen before tsc
aryasaatvik Oct 13, 2025
82b59ad
fix(docs): use consistent cn utility import
aryasaatvik Oct 14, 2025
683b3dd
feat(docs): use nuqs serializer for ChatGPT URL construction
aryasaatvik Oct 14, 2025
22ef450
feat(docs): add Suspense boundary with buttonVariants skeleton
aryasaatvik Oct 14, 2025
5cd30b9
feat(docs): move PageActionsSkeleton to page-actions component
aryasaatvik Oct 14, 2025
0027b7c
Merge branch 'next' into feat/llm-docs
aryasaatvik Oct 26, 2025
af1b68c
feat(docs): restructure LLM documentation output
aryasaatvik Oct 26, 2025
82120b0
feat(docs): add page exclusions for LLM text generation
aryasaatvik Oct 26, 2025
bf1fac4
fix(docs): filter out excluded pages in LLM text generation
aryasaatvik Oct 26, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions packages/docs/next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,32 @@ const config = {
]
},
reactStrictMode: true,
async rewrites() {
return [
{
source: "/docs/:path*",
has: [
{
type: "header",
key: "accept",
value: ".*text/(markdown|plain).*",
},
],
missing: [
{
type: "header",
key: "accept",
value: ".*text/html.*",
},
],
destination: "/llms/docs/:path*",
},
{
source: "/docs/:path*.md(x)?",
destination: "/llms/docs/:path*",
}
];
},
redirects: async () => {
return [
{
Expand Down
8 changes: 4 additions & 4 deletions packages/docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"build:registry": "shadcn build --output ./public",
"start": "next start",
"postinstall": "fumadocs-mdx",
"test": "tsc"
"test": "next typegen && tsc"
},
"dependencies": {
"@faker-js/faker": "^9.9.0",
Expand All @@ -47,9 +47,9 @@
"clsx": "^2.1.1",
"dayjs": "^1.11.13",
"effect": "^3.17.8",
"fumadocs-core": "^15.6.12",
"fumadocs-mdx": "^11.7.5",
"fumadocs-ui": "^15.6.12",
"fumadocs-core": "^15.8.5",
"fumadocs-mdx": "^12.0.3",
"fumadocs-ui": "^15.8.5",
"lucide-react": "^0.540.0",
"next": "15.5.0",
"nuqs": "workspace:*",
Expand Down
7 changes: 6 additions & 1 deletion packages/docs/source.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,12 @@ export default defineConfig({
})

export const { docs, meta } = defineDocs({
dir: 'content/docs'
dir: 'content/docs',
docs: {
postprocess: {
includeProcessedMarkdown: true,
},
}
})

export const blog = defineCollections({
Expand Down
17 changes: 16 additions & 1 deletion packages/docs/src/app/docs/[[...slug]]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ import {
} from 'fumadocs-ui/page'
import type { Metadata } from 'next'
import { notFound } from 'next/navigation'
import { Suspense } from 'react'
import { stat } from 'node:fs/promises'
import { LLMCopyButton, PageActionsSkeleton, ViewOptions } from '@/src/components/page-actions'

type PageProps = {
params: Promise<{ slug?: string[] }>
Expand All @@ -28,7 +30,20 @@ export default async function Page(props: PageProps) {
return (
<DocsPage toc={page.data.toc}>
<DocsTitle>{page.data.title}</DocsTitle>
<DocsDescription>{page.data.description}</DocsDescription>
<DocsDescription className="mb-0">{page.data.description}</DocsDescription>

<div className="border-b pb-6">
<Suspense fallback={<PageActionsSkeleton />}>
<div className="flex flex-row gap-2 items-center">
<LLMCopyButton markdownUrl={`${page.url}.mdx`} />
<ViewOptions
markdownUrl={`${page.url}.mdx`}
githubUrl={`https://github.com/47ng/nuqs/blob/dev/packages/docs/content/docs/${page.path}`}
/>
</div>
</Suspense>
</div>

<DocsBody>
<MDX components={useMDXComponents()} />
</DocsBody>
Expand Down
17 changes: 17 additions & 0 deletions packages/docs/src/app/llms-full.txt/route.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { source } from '@/src/app/source';
import { getLLMText } from '@/src/lib/get-llm-text';

// cached forever
export const revalidate = false;

const PAGE_EXCLUSIONS = [
"/docs/about",
];

export async function GET() {
const pages = source.getPages().filter(page => !PAGE_EXCLUSIONS.includes(page.url));
const scan = pages.map(getLLMText);
const scanned = await Promise.all(scan);

return new Response(scanned.join('\n\n'));
}
25 changes: 25 additions & 0 deletions packages/docs/src/app/llms.txt/route.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { source } from '@/src/app/source';
import { getLLMText } from '@/src/lib/get-llm-text';

// cached forever
export const revalidate = false;

export async function GET() {
const scanned: string[] = [];
scanned.push('# Docs');
const map = new Map<string, string[]>();

for (const page of source.getPages()) {
const dir = page.slugs[0];
const list = map.get(dir) ?? [];
list.push(`- [${page.data.title}](${page.url}): ${page.data.description}`);
map.set(dir, list);
}

for (const [key, value] of map) {
scanned.push(`## ${key}`);
scanned.push(value.join('\n'));
}

return new Response(scanned.join('\n\n'));
}
24 changes: 24 additions & 0 deletions packages/docs/src/app/llms/docs/[[...slug]]/route.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { getLLMText } from '@/src/lib/get-llm-text';
import { source } from '@/src/app/source';
import { notFound } from 'next/navigation';

export const revalidate = false;

export async function GET(
_req: Request,
{ params }: RouteContext<'/llms/docs/[[...slug]]'>,
) {
const { slug } = await params;
const page = source.getPage(slug);
if (!page) notFound();

return new Response(await getLLMText(page), {
headers: {
'Content-Type': 'text/markdown',
},
});
}

export function generateStaticParams() {
return source.generateParams();
}
Loading