Skip to content

feat: enable Markdown for Agents#121

Draft
ntatoud wants to merge 1 commit into
mainfrom
markdown-for-agents
Draft

feat: enable Markdown for Agents#121
ntatoud wants to merge 1 commit into
mainfrom
markdown-for-agents

Conversation

@ntatoud

@ntatoud ntatoud commented Apr 29, 2026

Copy link
Copy Markdown
Member

Summary

  • Adds src/integrations/markdown-for-agents.ts — an Astro build integration that converts every pre-rendered HTML page to a .md file in dist/ at build time (239 pages generated)
  • Updates vercel.ts to rewrite requests with Accept: text/markdown to the corresponding .md file and serve it with Content-Type: text/markdown; charset=utf-8
  • HTML stays the default for all browser requests

How it works

At build time, the integration walks dist/ and for each index.html file runs it through a unified pipeline (rehype-parse → rehype-remark → remark-gfm → remark-stringify) to produce a sibling .md file (e.g. dist/fr/blog/index.html → dist/fr/blog.md).

On Vercel, a rewrite rule matches any request whose Accept header contains text/markdown and transparently serves the .md file with the correct Content-Type header.

Test plan

  • curl -H "Accept: text/markdown" https://bearstudio.fr/fr returns markdown with Content-Type: text/markdown
  • curl https://bearstudio.fr/fr returns HTML as before
  • Validate via POST https://isitagentready.com/api/scanchecks.contentAccessibility.markdownNegotiation.status should be "pass"

🤖 Generated with Claude Code

Add build-time markdown generation and Vercel routing so requests
with Accept: text/markdown receive markdown responses with
Content-Type: text/markdown.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@vercel

vercel Bot commented Apr 29, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
bearstudio.fr Ready Ready Preview, Comment Apr 29, 2026 8:24am

Request Review

@yoannfleurydev

Copy link
Copy Markdown
Member

For this one, we need to check if we can do some Astro integration with this code. We had the "same" integration in Fork-It-Community/forkit.community#762

I'll take some time to review yours because I find the code in Fork it! Community's source code a bit "hacky".

@yoannfleurydev yoannfleurydev self-requested a review May 4, 2026 15:31
@ntatoud

ntatoud commented May 4, 2026

Copy link
Copy Markdown
Member Author

@yoannfleurydev yeah, I just quickly drafted this and wanted to refine, but I was not sure that was something we wanted. I simply would rather have it live on the remote than just on my machine.

I also have a working "hacky way" of doing this on my blog, so I wanted to find a better way to do that.

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.

2 participants