Back to browse
Accept.md now supports SvelteKit – return Markdown from any page

Accept.md now supports SvelteKit – return Markdown from any page

by hval·Feb 28, 2026·2 points·0 comments

AI Analysis

●●SolidBig BrainSolve My Problem

Content negotiation middleware for Markdown: clever HTTP, but solves a narrow routing problem.

Strengths
  • Uses proper HTTP semantics (Accept headers) instead of custom endpoints or scraping logic.
  • Zero-impact integration: middleware handles everything, components untouched, Vercel-compatible deployment.
  • Real use case for LLMs and internal tools that prefer Markdown over HTML.
Weaknesses
  • Limited to Next.js/SvelteKit ecosystem; competing solutions exist (custom API routes, CDN edge functions).
  • Niche audience: most teams don't need Markdown export; add-on rather than core feature.
Target Audience

Next.js and SvelteKit developers, AI/LLM teams, content syndication

Similar To

Next.js API routes with content-type negotiation · Custom export endpoints in frameworks · Jina AI Reader (full-page Markdown extraction)

Post Description

A few days ago I shared accept.md, a small utility that lets a Next.js page return Markdown when the client sends:

Accept: text/markdown

Instead of HTML.

No one asked for SvelteKit support, still I shipped it.

It now works with:

* Next.js (App Router and Pages Router) * SSG / SSR / ISR * SvelteKit routes * Vercel (no custom server required)

What it does:

If a client sends:

Accept: text/markdown

The exact same page returns clean Markdown.

If not, it behaves normally and renders HTML.

No duplicate routes. No separate .md files. No API layer. No SEO changes.

Just proper HTTP content negotiation.

Why I built this:

LLMs prefer Markdown. Internal tools prefer Markdown. Scrapers prefer Markdown. CLI workflows prefer Markdown.

But most sites only return HTML.

The usual solutions are:

* Maintain a parallel Markdown version * Build a custom export route * Create a docs API * Spin up a custom server

That felt unnecessary.

Browsers already send Accept: text/html. Agents can send Accept: text/markdown.

HTTP already solves this. Accept.md just makes it easy to use content negotiation inside modern frameworks without breaking static generation or edge deployments.

Design goals:

* Zero UI changes * Zero runtime cost for normal visitors * Works with static builds * Cache-friendly * Framework-native

It’s intentionally small. No heavy abstraction. Just a clean way to expose Markdown representations of existing pages.

Would love feedback — especially from people building AI-native apps, documentation systems, or content-heavy SaaS.

Curious whether Markdown negotiation becomes more common as agents become first-class web clients.

Similar Projects