Skip to content

Commit 577bbec

Browse files
committed
Remove clean markdown generation and artifacts.
Stop generating and committing clean markdown files in CI, simplify markdown serving/indexing to use source content directly, and remove .md URL suffixes from llms output and markdown alternates for the current main behavior. Made-with: Cursor
1 parent 2e574c9 commit 577bbec

File tree

265 files changed

+303
-183925
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

265 files changed

+303
-183925
lines changed

.github/workflows/generate-markdown.yml

Lines changed: 0 additions & 90 deletions
This file was deleted.

.github/workflows/llmstxt.yml

Lines changed: 2 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,15 @@ name: Generate LLMs.txt
22

33
on:
44
workflow_dispatch:
5-
pull_request:
6-
types: [opened, synchronize, reopened]
75

86
permissions:
9-
contents: write
10-
pull-requests: write
7+
contents: read
118

129
jobs:
1310
llmstxt:
1411
name: Generate LLMSTXT
1512
runs-on: ubuntu-latest
1613

17-
permissions:
18-
contents: write
19-
pull-requests: write
20-
2114
steps:
2215
- name: Use Node.js
2316
uses: actions/setup-node@v4
@@ -27,7 +20,7 @@ jobs:
2720
- name: Checkout code
2821
uses: actions/checkout@v4
2922
with:
30-
ref: ${{ github.event.pull_request.head.ref || github.ref }}
23+
ref: ${{ github.ref }}
3124
token: ${{ secrets.DOCS_PUBLISHABLE_GH_TOKEN }}
3225

3326
- name: Install dependencies
@@ -40,41 +33,3 @@ jobs:
4033
run: pnpm llmstxt
4134
env:
4235
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
43-
44-
- name: Check for changes
45-
id: check-changes
46-
run: |
47-
if [ -n "$(git status --porcelain)" ]; then
48-
echo "has_changes=true" >> $GITHUB_OUTPUT
49-
else
50-
echo "has_changes=false" >> $GITHUB_OUTPUT
51-
fi
52-
53-
- name: Commit changes to PR
54-
if: steps.check-changes.outputs.has_changes == 'true' && github.event_name == 'pull_request'
55-
run: |
56-
git config user.name "github-actions[bot]"
57-
git config user.email "github-actions[bot]@users.noreply.github.com"
58-
git add public/llms.txt
59-
git commit -m "🤖 Regenerate LLMs.txt"
60-
git push
61-
62-
- name: Create Pull Request (for scheduled/manual runs)
63-
if: steps.check-changes.outputs.has_changes == 'true' && github.event_name != 'pull_request'
64-
id: cpr
65-
uses: peter-evans/create-pull-request@v7
66-
with:
67-
token: ${{ secrets.DOCS_PUBLISHABLE_GH_TOKEN }}
68-
commit-message: Regenerate LLMs.txt and related files
69-
branch: auto-update-llms-txt
70-
delete-branch: true
71-
title: "🤖 Regenerate LLMs.txt"
72-
reviewers: >
73-
evantahler
74-
torresmateo
75-
76-
- name: Enable Pull Request Automerge
77-
if: steps.check-changes.outputs.has_changes == 'true' && github.event_name != 'pull_request'
78-
run: gh pr merge --squash --auto ${{ steps.cpr.outputs.pull-request-number }}
79-
env:
80-
GH_TOKEN: ${{ secrets.DOCS_PUBLISHABLE_GH_TOKEN }}

CLAUDE.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ pnpm vale:check # Check docs against style rules
1515
```
1616

1717
Run a single test:
18+
1819
```bash
1920
pnpm vitest run tests/broken-link-check.test.ts
2021
```
@@ -26,7 +27,7 @@ pnpm vitest run tests/broken-link-check.test.ts
2627
- **`app/_lib/`** — Data-fetching utilities (toolkit catalog, slug generation, static params).
2728
- **`app/api/`** — API routes (markdown export, toolkit-data, glossary).
2829
- **`toolkit-docs-generator/`** — Generates MCP toolkit documentation from server metadata JSON files in `toolkit-docs-generator/data/toolkits/`.
29-
- **`scripts/`** — Build/CI scripts (clean markdown export, Vale style fixes, redirect checking, pagefind indexing, i18n sync).
30+
- **`scripts/`** — Build/CI scripts (Vale style fixes, redirect checking, pagefind indexing, i18n sync).
3031
- **`tests/`** — Vitest tests (broken links, internal link validation, sitemap, smoke tests).
3132
- **`lib/`** — Next.js utilities (glossary remark plugin, llmstxt plugin).
3233
- **`next.config.ts`** — Contains ~138 redirect rules.

app/_components/copy-page-override.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ const DROPDOWN_IDENTIFIER = "Markdown for LLMs";
1010

1111
/**
1212
* This component overrides the default nextra-theme-docs "Copy page" button behavior
13-
* to fetch clean markdown from our API instead of copying raw MDX source.
13+
* to fetch markdown from our API instead of copying raw MDX source.
1414
*/
1515
export function CopyPageOverride() {
1616
const pathname = usePathname();
1717

1818
const fetchAndCopyMarkdown = useCallback(async (): Promise<boolean> => {
1919
try {
20-
const markdownUrl = `/api/markdown${pathname}.md`;
20+
const markdownUrl = `/api/markdown${pathname}`;
2121
const response = await fetch(markdownUrl);
2222

2323
if (!response.ok) {

app/_components/toolkit-docs/components/page-actions.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ function CopyPageButton() {
6060

6161
setLoading(true);
6262
try {
63-
const response = await fetch(`/api/markdown${pathname}.md`);
63+
const response = await fetch(`/api/markdown${pathname}`);
6464
if (!response.ok) {
6565
throw new Error("Failed to fetch markdown");
6666
}

app/api/markdown/[[...slug]]/route.ts

Lines changed: 1 addition & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@ const MD_EXTENSION_REGEX = /\.md$/;
1010
const TOOLKIT_MARKDOWN_ROOT = join(process.cwd(), "public", "toolkit-markdown");
1111
const APP_ROOT = join(process.cwd(), "app");
1212

13-
// Directory containing pre-generated clean markdown files
14-
const CLEAN_MARKDOWN_DIR = join(process.cwd(), "public", "_markdown");
15-
1613
/**
1714
* Validates that a resolved path is within the allowed directory.
1815
* Prevents path traversal attacks (e.g., ../../../etc/passwd).
@@ -108,39 +105,6 @@ type ToolkitMarkdownTarget = {
108105
toolkitId: string;
109106
};
110107

111-
/**
112-
* Try to serve clean pre-generated markdown.
113-
* Returns NextResponse if found, null otherwise.
114-
*/
115-
async function tryServeCleanMarkdown(
116-
request: NextRequest,
117-
sanitizedPath: string
118-
): Promise<NextResponse | null> {
119-
const cleanMarkdownPath = join(CLEAN_MARKDOWN_DIR, `${sanitizedPath}.md`);
120-
121-
try {
122-
await access(cleanMarkdownPath);
123-
if (!isPathWithinDirectory(cleanMarkdownPath, CLEAN_MARKDOWN_DIR)) {
124-
return null;
125-
}
126-
127-
const content = await readFile(cleanMarkdownPath, "utf-8");
128-
await trackMarkdownRequest(request, sanitizedPath);
129-
130-
return new NextResponse(content, {
131-
status: 200,
132-
headers: {
133-
"Content-Type": "text/markdown; charset=utf-8",
134-
"Content-Disposition": "inline",
135-
"Cache-Control": "public, max-age=3600",
136-
Vary: "Accept, User-Agent",
137-
},
138-
});
139-
} catch {
140-
return null;
141-
}
142-
}
143-
144108
/**
145109
* Check if a path matches the toolkit documentation pattern.
146110
* Handles both actual toolkit IDs and the [toolkitId] dynamic route pattern.
@@ -248,13 +212,7 @@ export async function GET(
248212
filePath = join(APP_ROOT, `${sanitizedPath}/page.mdx`);
249213
}
250214
} else {
251-
// Try clean markdown first (preferred)
252-
const cleanResponse = await tryServeCleanMarkdown(request, sanitizedPath);
253-
if (cleanResponse) {
254-
return cleanResponse;
255-
}
256-
257-
// Fallback: raw MDX file
215+
// Serve raw MDX file.
258216
filePath = join(APP_ROOT, `${sanitizedPath}/page.mdx`);
259217
}
260218

app/en/get-started/setup/connect-arcade-docs/page.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description: "Learn how to speed up your development with agents in your IDEs"
55

66
# Agentic Development
77

8-
Every page on the Arcade docs site renders as clean markdown. When an AI agent or coding assistant visits any docs URL, the site automatically returns `Content-Type: text/markdown` instead of HTML if:
8+
Every page on the Arcade docs site can be served as markdown. When an AI agent or coding assistant visits any docs URL, the site automatically returns `Content-Type: text/markdown` instead of HTML if:
99

1010
- The request `User-Agent` header matches a known AI agent (Claude, ChatGPT, Cursor, etc.)
1111
- The request includes the `Accept: text/markdown` header

app/layout.tsx

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,16 @@ import {
2222
} from "nextra-theme-docs";
2323

2424
const REGEX_LOCALE = /^\/([a-z]{2}(?:-[A-Z]{2})?)(?:\/|$)/;
25+
const ENABLE_MARKDOWN_ALTERNATE = false;
2526

2627
function getMarkdownAlternatePath(pathname: string): string {
2728
// Handle root paths
2829
if (pathname === "/" || pathname === "") {
29-
return "/index.md";
30+
return "/";
3031
}
31-
// Remove trailing slash if present, then add .md extension
32+
// Remove trailing slash if present.
3233
const cleanPath = pathname.endsWith("/") ? pathname.slice(0, -1) : pathname;
33-
return `${cleanPath}.md`;
34+
return cleanPath;
3435
}
3536

3637
export async function generateMetadata() {
@@ -77,11 +78,13 @@ export async function generateMetadata() {
7778
appleWebApp: {
7879
title: "Arcade Documentation",
7980
},
80-
alternates: {
81-
types: {
82-
"text/markdown": getMarkdownAlternatePath(pathname),
83-
},
84-
},
81+
alternates: ENABLE_MARKDOWN_ALTERNATE
82+
? {
83+
types: {
84+
"text/markdown": getMarkdownAlternatePath(pathname),
85+
},
86+
}
87+
: undefined,
8588
other: {
8689
"apple-mobile-web-app-title": "Arcade Documentation",
8790
"twitter:url": "https://docs.arcade.dev",

middleware.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,15 +101,15 @@ function getLocaleFromPathname(pathname: string, request: NextRequest): string {
101101

102102
function buildMarkdownPath(pathname: string, locale: string): string {
103103
if (pathname === "/" || pathname === "") {
104-
return `/${locale}/home.md`;
104+
return `/${locale}/home`;
105105
}
106106
if (pathnameIsMissingLocale(pathname)) {
107-
return `/${locale}${pathname}.md`;
107+
return `/${locale}${pathname}`;
108108
}
109109
if (SUPPORTED_LOCALES.some((loc) => pathname === `/${loc}`)) {
110-
return `${pathname}/home.md`;
110+
return `${pathname}/home`;
111111
}
112-
return `${pathname}.md`;
112+
return pathname;
113113
}
114114

115115
function isToolkitDetailPath(pathname: string): boolean {

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@
1111
"format": "pnpm exec ultracite fix",
1212
"prepare": "husky install",
1313
"toolkit-markdown": "pnpm dlx tsx toolkit-docs-generator/scripts/generate-toolkit-markdown.ts",
14-
"postbuild": "if [ \"$SKIP_POSTBUILD\" != \"true\" ]; then pnpm run generate:markdown && pnpm run custompagefind; fi",
15-
"generate:markdown": "pnpm dlx tsx scripts/generate-clean-markdown.ts",
14+
"postbuild": "if [ \"$SKIP_POSTBUILD\" != \"true\" ]; then pnpm run custompagefind; fi",
1615
"translate": "pnpm dlx tsx scripts/i18n-sync/index.ts && pnpm format",
1716
"llmstxt": "pnpm dlx tsx scripts/generate-llmstxt.ts",
1817
"custompagefind": "pnpm dlx tsx scripts/pagefind.ts",

0 commit comments

Comments
 (0)