docs: serve plain markdown for AI agents#11435
Merged
Conversation
NigelBreslaw
approved these changes
Apr 20, 2026
Lets AI agents fetch /docs/.../foo.md instead of the HTML page, saving tokens on retrieval. Implemented as a static Astro endpoint over the docs collection, so it works the same on Cloudflare Pages and Netlify with no per-host routing.
The markdown sibling endpoint now resolves the <Link/> component into a real markdown link pointing at the target page's .md sibling, so AI agents can chain markdown fetches without rewriting URLs. Two safety nets keep the output honest: - A Playwright spec asserts no unresolved MDX components leak into any built .md file. - A post-build script walks the .md corpus with remark and verifies every internal link points at an existing file. Wired into the build step so a broken link fails the build.
aef946c to
1b4bdda
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Publishes a plain-markdown sibling for every doc page (e.g.
/docs/guide/language/coding/properties.mdnext to/docs/guide/language/coding/properties/) so AI agents can consume the docs without paying the HTML/JS token overhead. The<Link/>component is resolved into real markdown links pointing at the target page's.mdsibling so an agent can chain markdown fetches without rewriting URLs. A post-build script + Playwright spec keep the output honest (no leaked components, all internal links resolve).Discoverability is the next decision, not done here. Two paths from this point: (a) dynamic content negotiation via Cloudflare Pages / Netlify Edge functions on the canonical URL, or (b) advertise the convention out-of-band — e.g. our
/slintskill tells the agent to append.mdto any docs URL. The static.mdfiles are the substrate either approach builds on.