You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When an AI agent requests a page (detected via Accept: text/markdown header, recognized AI user agent patterns, or .md URL suffix), the response should be automatically converted from HTML to clean markdown.
Why
As AI agents increasingly interact with web applications, serving structured markdown instead of raw HTML improves:
AI comprehension — markdown is a more natural format for LLMs to parse
Token efficiency — markdown is significantly smaller than HTML, reducing token usage
Summary
Integrate spatie/laravel-markdown-response to serve markdown-formatted responses to AI agents and bots.
When an AI agent requests a page (detected via
Accept: text/markdownheader, recognized AI user agent patterns, or.mdURL suffix), the response should be automatically converted from HTML to clean markdown.Why
As AI agents increasingly interact with web applications, serving structured markdown instead of raw HTML improves:
Implementation Details
Package Features
Markdown::fake()andMarkdown::assertConverted()for testingTasks
spatie/laravel-markdown-responseProvideMarkdownResponsemiddleware to relevant route groupsRelated