Add clean markdown generation for LLM-friendly page content #723
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently our public markdown files are littered with janky JSX components that LLMs can't read and link to HTML files instead of other markdown files. This PR FIXES that.
Summary
/api/markdownendpoint to serve pre-generated clean markdown (falls back to real-time conversion)CopyPageOverridecomponent that intercepts the "Copy page" button to fetch clean markdown from the API<meta>tags to generated markdown filespublic/_markdown/to.gitignoreChanges
scripts/generate-clean-markdown.ts: New script that runs a production server, fetches rendered HTML, and converts to clean markdown using Turndownapp/api/markdown/[[...slug]]/route.ts: Updated to serve pre-generated markdown first, with fallbackapp/_components/copy-page-override.tsx: Client component that intercepts copy button clicksapp/_components/custom-layout.tsx: Includes the CopyPageOverride componentscripts/generate-llmstxt.ts: Uses pre-generated clean markdown if availablepackage.json: Added build scripts for generating clean markdownTest plan
pnpm buildto verify the build succeedspnpm generate:clean-markdownto verify markdown generation works/api/markdown/en/home.mdreturns markdown with frontmatter🤖 Generated with Claude Code