Skip to content

feat: serve raw markdown at .md URLs for AI agents#4572

Open
lennessyy wants to merge 11 commits into
mainfrom
markdown-pages-plugin
Open

feat: serve raw markdown at .md URLs for AI agents#4572
lennessyy wants to merge 11 commits into
mainfrom
markdown-pages-plugin

Conversation

@lennessyy
Copy link
Copy Markdown
Contributor

@lennessyy lennessyy commented May 15, 2026

Summary

  • Adds a markdown-pages Docusaurus plugin that copies raw .mdx/.md source files to the build output at their corresponding URL paths with a .md extension (e.g., docs.temporal.io/security.md serves the raw markdown for the security page).
  • Respects slug and id frontmatter overrides for URL path resolution.
  • Pages can opt out by setting llm_exclude in frontmatter to a string explaining why the page isn't available as markdown. Agents receive that explanation instead of a 404.

Test plan

  • Verified docusaurus build succeeds, generating 583 markdown files
  • Verified .md files are placed at correct URL paths (including slug overrides)
  • Verified docusaurus serve returns raw markdown at .md URLs
  • Test llm_exclude frontmatter on a page (e.g., the serverless demo page)

🤖 Generated with Claude Code

┆Attachments: EDU-6365 feat: serve raw markdown at .md URLs for AI agents

Adds a Docusaurus plugin that copies raw markdown source files to the
build output at their corresponding URL paths with a .md extension.
This lets AI agents fetch individual doc pages as markdown by appending
.md to any docs URL.

Pages can opt out by setting llm_exclude in frontmatter to a string
explaining why, which is served in place of the raw content.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@lennessyy lennessyy requested a review from a team as a code owner May 15, 2026 00:10
@vercel
Copy link
Copy Markdown

vercel Bot commented May 15, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
temporal-documentation Ready Ready Preview, Comment May 15, 2026 8:01pm

Request Review

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 15, 2026

📖 Docs PR preview links

@brianmacdonald-temporal
Copy link
Copy Markdown
Contributor

This looks fantastic! Great addition; thanks.
Just for safety, I'd like to test the llm_exclude option before we go live, but other than that, approved.

encyclopedia/index.mdx now outputs encyclopedia.md instead of
encyclopedia/index.md, matching how Docusaurus routes index pages.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Tells agents in llms.txt that they can append .md to any page URL
to fetch raw Markdown source.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Adds Vercel rewrites that serve raw markdown when a request includes
Accept: text/markdown. Agents can request any docs URL with this
header and get the .md source instead of the rendered HTML page.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace vercel.json rewrites (which run after static file matching)
with Vercel Routing Middleware that runs before. When a request
includes Accept: text/markdown, the middleware rewrites to the .md
file. Otherwise it passes through to the normal static HTML.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Set framework: null with explicit build config so Vercel treats
this as a generic project that supports Routing Middleware, while
still building Docusaurus correctly.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Try .js extension for middleware detection. Revert framework: null
since the Docusaurus preset shouldn't block middleware.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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