Skip to content

feat: improve AcceptMarkdown support#209

Draft
dcrawbuck wants to merge 1 commit into
mainfrom
duncan/sw-5396-docs-full-acceptmarkdowncom-support
Draft

feat: improve AcceptMarkdown support#209
dcrawbuck wants to merge 1 commit into
mainfrom
duncan/sw-5396-docs-full-acceptmarkdowncom-support

Conversation

@dcrawbuck
Copy link
Copy Markdown
Collaborator

@dcrawbuck dcrawbuck commented Jun 3, 2026

This adds AcceptMarkdown-compliant content negotiation for docs routes, including Fumadocs-based q-value negotiation, Vary: Accept, alternate/canonical Link headers, and 406 responses for unsupported media types.
It adds Markdown alternate URL helpers plus root and nested /llms.mdx/docs routes so /docs/, .md, .mdx, and canonical docs URLs all resolve to Markdown where appropriate.
It switches processed Markdown generation to Fumadocs placeholder rendering for common MDX components, making Markdown cleaner for agents while keeping HTML pages unchanged.
It adds tests for negotiation and rewrite behavior; local validation covered bun test, bun run build:cf, curl checks against local dev, and agent-browser checks.


Note

Medium Risk
Changes global request middleware and URL routing for all docs traffic; behavior is well-tested but mis-negotiation could affect crawlers and LLM clients.

Overview
Adds AcceptMarkdown-style docs serving: Accept negotiation (including q-values and legacy markdown types), Vary: Accept, HTML Link alternates to markdown, and 406 for unsupported explicit types. Canonical /docs/..., .md, and .mdx URLs rewrite to markdown handlers when appropriate.

Introduces markdown-alternate URL/header helpers and nests /llms.mdx/docs routes (index + per-page) with canonical HTML Link headers; the docs index and page routes expose rel="alternate" markdown links and point copy/view actions at the new paths.

Processed markdown now uses Fumadocs mdxAsPlaceholder plus runtime renderers for common MDX components (tabs, callouts, etc.) so agent-facing output is cleaner; HTML pages are unchanged.

Tests cover negotiation, rewrites, and legacy redirects.

Reviewed by Cursor Bugbot for commit e202a5f. Bugbot is set up for automated code reviews on this repo. Configure here.

@linear
Copy link
Copy Markdown

linear Bot commented Jun 3, 2026

SW-5396

@cloudflare-workers-and-pages
Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
superwall-docs-staging e202a5f Commit Preview URL

Branch Preview URL
Jun 03 2026, 11:52 PM

@dcrawbuck dcrawbuck changed the title Improve docs AcceptMarkdown support feat: improve AcceptMarkdown support Jun 3, 2026
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.

1 participant