---
title: "Markdown to agents, HTML to humans"
description: "Demo project for delivering markdown to agents and HTML to humans."
url: "https://vercel.com/templates/next.js/markdown-to-agents-html-to-humans"
links:
  repository: "https://github.com/vercel-labs/markdown-to-agents"
  demo: "https://markdown-to-agents.vercel.app/docs/getting-started"
  deploy: "https://vercel.com/new/clone?demo-title=Markdown+to+agents%2C+HTML+to+humans&demo-description=Demo+project+for+delivering+markdown+to+agents+and+HTML+to+humans.&demo-url=https%3A%2F%2Fmarkdown-to-agents.vercel.app%2Fdocs%2Fgetting-started&demo-image=%2F%2Fimages.ctfassets.net%2Fe5382hct74si%2F39DXAApkhWUwN3Wx6UCM2f%2F534403c2574dd52d2d3c64941c4205e4%2FCleanShot_2025-09-28_at_22.35.12_2x.png&project-name=Markdown+to+agents%2C+HTML+to+humans&repository-name=markdown-to-agents-html-to-humans&repository-url=https%3A%2F%2Fgithub.com%2Fvercel-labs%2Fmarkdown-to-agents&from=templates&skippable-integrations=1"
---

# Markdown to agents, HTML to humans

Demo project for delivering markdown to agents and HTML to humans.

Delivering Markdown to Agents, HTML to Humans

This demo project shows how to serve different formats of the same documentation depending on the client. AI agents benefit from receiving lightweight Markdown instead of full HTML, while browsers still get standard HTML for human readers.

By serving Markdown directly, we cut down token usage for AI agents, making it more efficient for them to parse and process documentation.

## Demo

Compare

```
 curl -H "Accept: text/markdown" https://markdown-to-agents.vercel.app/docs/getting-started
```

and

```
 curl -H "Accept: text/html" https://markdown-to-agents.vercel.app/docs/getting-started
```

## How it works

The rewrite in `next.config.ts` directs traffic asking for `text/markdown` to a route that returns markdown.

```typescript
const nextConfig: NextConfig = {
  rewrites: async () => {
    return {
      beforeFiles: [
        {
          source: "/docs/:slug",
          destination: "/markdown/:slug",
          has: [
            {
              type: "header",
              key: "accept",
              value: "(.*)text/markdown(.*)",
            },
          ],
        },
      ],
    };
  },
};
```

## Related Templates

### [Slack Agent Template](https://vercel.com/templates/nitro/slack-agent-template)

This is a Slack Agent template built with Bolt for JavaScript (TypeScript) and the Nitro server framework.

---

## Additional documentation

The [Vercel Knowledge Base](https://vercel.com/kb) contains guides and answers to common questions about Vercel, including deployment, framework configuration, domains, caching, and troubleshooting.
