Skip to content

docs: serve plain markdown for AI agents#11435

Merged
tronical merged 2 commits intomasterfrom
simon/markdown
Apr 20, 2026
Merged

docs: serve plain markdown for AI agents#11435
tronical merged 2 commits intomasterfrom
simon/markdown

Conversation

@tronical
Copy link
Copy Markdown
Member

Publishes a plain-markdown sibling for every doc page (e.g. /docs/guide/language/coding/properties.md next 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 .md sibling 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 /slint skill tells the agent to append .md to any docs URL. The static .md files are the substrate either approach builds on.

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.
@tronical tronical enabled auto-merge (rebase) April 20, 2026 11:15
@tronical tronical merged commit acfcb8d into master Apr 20, 2026
40 checks passed
@tronical tronical deleted the simon/markdown branch April 20, 2026 11:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants