Skip to content

feat: add @hono/markdown-for-agents middleware#1806

Open
KKonstantinov wants to merge 2 commits intohonojs:mainfrom
KKonstantinov:feature/hono-markdown-for-agents-package
Open

feat: add @hono/markdown-for-agents middleware#1806
KKonstantinov wants to merge 2 commits intohonojs:mainfrom
KKonstantinov:feature/hono-markdown-for-agents-package

Conversation

@KKonstantinov
Copy link
Copy Markdown

@KKonstantinov KKonstantinov commented Mar 18, 2026

Hono middleware for markdown-for-agents — converts HTML responses to clean, token-efficient Markdown when clients send Accept: text/markdown.

AI agents get ~80–90% token savings. Normal browser requests pass through untouched.

import { Hono } from 'hono'
import { markdown } from '@hono/markdown-for-agents'

const app = new Hono()
app.use(markdown())

app.get('/', (c) => {
  return c.html('<h1>Hello</h1>')
})

export default app
# Normal HTML response
curl http://localhost:3000

# Markdown response for AI agents
curl -H "Accept: text/markdown" http://localhost:3000

The response includes Content-Type: text/markdown, x-markdown-tokens, ETag, Vary: Accept, and optional content-signal / server-timing headers.

See the markdown-for-agents docs for full options and the playground.

The author should do the following, if applicable

  • Add tests
  • Run tests
  • yarn changeset at the top of this repo and push the changeset
  • Follow the contribution guide

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Mar 18, 2026

🦋 Changeset detected

Latest commit: 6810517

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@hono/markdown-for-agents Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

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