Skip to content

Serve Markdown when a client sends Accept: text/markdown #575

Closed

Description

@aicayzer

Summary

An agent that asks a page for Markdown with the Accept header gets HTML today. Serve Markdown for that request, and tell clients where the Markdown copy is.

Context

At docs commit aeb5162, GET /overview/ with Accept: text/markdown answers 200 with content-type: text/html. /overview.md answers text/markdown. A path without a trailing slash answers 307 to the slash form. Cloudflare reports that Markdown negotiation works on 3.9% of the top 200,000 domains and names Claude Code, OpenCode and Cursor as clients that send the header by default (https://blog.cloudflare.com/agent-readiness/, April 2026; I did not test those clients).

Acceptance criteria

  • A request to any page address that prefers text/markdown in Accept, with or without a trailing slash, answers the same body as the page's .md copy, with content-type: text/markdown and Vary: Accept.
  • A browser request still gets HTML, and Vary: Accept stops a cache serving one form to the other.
  • Each HTML page has <link rel="alternate" type="text/markdown" href="<path>.md"> in its head.
  • A test covers the Markdown request, the HTML request and the missing page (404).

Out of scope

  • Generating a skill.md or other agent files.

Notes

Pages are prerendered and AGENTS.md ("Worker route frozen") warns about routes that must stay Worker-served. I did not check whether a static HTML file is served before the Worker runs, which would stop the header being read. If so, the Worker may need to run first for page paths.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions