Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Laravel Markdown Response Laravel Package

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.

View on GitHub
Deep Wiki
Context7

title: Test your setup weight: 4

To verify your markdown conversion works correctly in tests, you can fake the Markdown facade. This prevents actual HTML-to-markdown conversion and lets you make assertions about what was converted.

use Spatie\MarkdownResponse\Facades\Markdown;

beforeEach(function () {
    Markdown::fake();
});

Assert conversions happened

Use assertConverted to verify that at least one conversion took place:

Markdown::fake();

$this->get('/about.md')->assertOk();

Markdown::assertConverted();

You can pass a callable for more specific assertions. The callable receives the HTML string:

Markdown::assertConverted(fn (string $html) => str_contains($html, '<h1>About</h1>'));

Assert no conversions happened

Use assertNotConverted to verify that no conversions were made:

Markdown::fake();

$this->get('/about')->assertOk();

Markdown::assertNotConverted();

Assert conversion count

Use assertConvertedCount to verify the exact number of conversions:

Markdown::fake();

$this->get('/about.md');
$this->get('/posts/1.md');
$this->get('/posts/2.md');

Markdown::assertConvertedCount(3);
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
hamzi/corewatch
minionfactory/raw-hydrator
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle
atriumphp/atrium
sandermuller/package-boost-laravel
sandermuller/boost-skills
redaxo/core
yusufgenc/filament-api-forge
l3aro/rating-star-for-filament
leek/filament-subtenant-scope