spatie/laravel-markdown-response
Serve markdown versions of your Laravel HTML pages for AI agents and bots. Detect markdown requests via Accept: text/markdown, known user agents, or .md URLs. Driver-based conversion (local PHP or Cloudflare Workers AI), with caching and HTML preprocessing.
spatie/laravel-html-response (included as a sub-dependency) and league/html-to-markdown, reducing risk of version conflicts.Cache::remember) may conflict with Laravel’s built-in caching layers if not configured explicitly.<canvas>, <video>) default to [unsupported] tags. Custom processors may be needed for specialized content./docs)? Partial integration may reduce risk.Accept: text/markdown headers).MarkdownResponse::generate()).league/html-to-markdown if needed./docs/intro).curl -H "Accept: text/markdown".Cache::tags('markdown')).Response macros.composer require spatie/laravel-markdown-response.app/Http/Kernel.php.spatie/laravel-html-response and league/html-to-markdown for breaking changes. MIT license allows forks if needed.app/Markdown/).Accept: text/markdown headers).throttle:60 for markdown-heavy routes).| Failure Scenario | Impact | Mitigation |
|---|---|---|
| Malformed HTML input | Broken markdown output | Validate HTML structure pre-conversion. |
| Markdown parser regression | AI agent parsing failures | Test with CI (e.g., phpunit + sample HTML). |
| Cache stampede | High memory usage | Use Cache::tags() for granular invalidation. |
| AI agent markdown parser limits | Truncated/ignored content | Document supported markdown features. |
| Middleware conflicts | Silent failures | Test middleware order early. |
How can I help you explore Laravel packages today?