spatie/laravel-markdown-response
Serve clean markdown versions of your Laravel HTML pages for AI agents and bots. Detects requests via Accept: text/markdown, known user agents, or .md URLs. Driver-based conversion (local PHP or Cloudflare Workers AI), caching, and HTML preprocessing included.
Besides automatic conversion via the middleware, you can convert HTML to markdown anywhere in your code using the Markdown facade:
use Spatie\MarkdownResponse\Facades\Markdown;
$markdown = Markdown::convert('<h1>Hello</h1><p>World</p>');
The conversion uses whichever driver is configured in markdown-response.driver and runs all configured preprocessors before converting.
You can switch drivers on the fly using the using() method:
$markdown = Markdown::using('cloudflare')->convert($html);
How can I help you explore Laravel packages today?