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

Product Decisions This Supports

  • AI-First Content Strategy: Enable seamless integration with AI agents (e.g., GPTBot, ClaudeBot) by serving clean, structured markdown instead of bloated HTML. Aligns with roadmap items like "Improve AI discoverability" or "Optimize for generative AI tools."
  • Build vs. Buy: Avoid reinventing HTML-to-markdown conversion logic (e.g., parsing, caching, or driver management). Leverage a battle-tested, MIT-licensed package with minimal dev overhead.
  • Developer Experience (DX): Reduce friction for frontend teams by automating markdown responses via middleware, attributes, or URL suffixes (e.g., /about.md). Supports initiatives like "Unify content delivery" or "Reduce technical debt."
  • Performance Optimization: Cache markdown responses (TTL-configurable) to offload conversion logic from runtime, reducing server load for repeated AI requests.
  • Multi-Channel Publishing: Serve the same content in HTML (users) and markdown (AI) without duplicating templates or logic. Critical for "Omnichannel content" or "Headless CMS" roadmaps.
  • Testing & Reliability: Built-in testing utilities (Markdown::fake()) simplify CI/CD pipelines for markdown conversion logic, ensuring regressions are caught early.

When to Consider This Package

  • Adopt if:

    • Your Laravel app serves content to AI agents (e.g., documentation, blogs, or knowledge bases) and you want to improve parsing quality.
    • You need low-effort integration (middleware, URL suffixes, or attributes) without modifying existing controllers/views.
    • Your team prioritizes developer velocity over fine-grained control (e.g., custom HTML preprocessing).
    • You’re already using Cloudflare Workers and want to leverage their AI API for higher-quality conversions.
    • Caching markdown responses aligns with your performance goals (e.g., high-traffic public APIs).
  • Look elsewhere if:

    • You require real-time markdown generation (no caching) or need to support dynamic content (e.g., user-generated HTML).
    • Your HTML is highly dynamic (e.g., SPAs with heavy client-side rendering) or relies on JavaScript for critical content—consider a headless CMS or static site generator instead.
    • You need advanced markdown customization (e.g., custom syntax, footnotes) beyond what the League driver or Cloudflare API supports.
    • Your stack isn’t Laravel/PHP, or you’re using a framework with built-in markdown support (e.g., Next.js, Jekyll).
    • You’re serving binary data (images, PDFs) or non-HTML responses (JSON APIs)—this package focuses on text/htmltext/markdown.

How to Pitch It (Stakeholders)

For Executives:

"This package lets us serve clean, AI-friendly markdown versions of our web content automatically—without rewriting our existing Laravel app. Think of it like adding a 'markdown mode' for search engines and AI tools, which can improve our visibility in generative AI results (e.g., Google’s SGE, Bing Chat). It’s a low-risk, high-reward way to future-proof our content for the AI era, with minimal dev effort. We can toggle it on/off globally or per-page, and it caches responses to avoid performance hits."

Key Outcomes:

  • Better AI discoverability (e.g., your docs/blogs appear in AI-generated summaries).
  • No content duplication (one source of truth for HTML/markdown).
  • Scales with traffic (caching reduces server load).

For Engineering:

*"This solves a growing pain point: AI agents can’t parse our HTML well, leading to incomplete or noisy responses. The package adds a middleware that:

  1. Detects AI requests (via Accept: text/markdown, .md URLs, or bot UAs).
  2. Converts HTML→markdown (local PHP or Cloudflare Workers AI driver).
  3. Caches responses (TTL-configurable) to avoid reprocessing.
  4. Works alongside existing routes—no controller changes needed.

Why this over DIY?

  • Battle-tested: Uses league/html-to-markdown (10K+ stars) or Cloudflare’s AI API.
  • Flexible: Supports attributes (#[ProvideMarkdown]), global middleware, or per-route opt-outs.
  • Testable: Built-in faking for CI/CD (Markdown::fake()).

Tradeoffs:

  • Cloudflare driver requires API setup but offers better JS/rich-HTML support.
  • Caching means stale content if your HTML changes frequently (but TTL is configurable).

Next Steps:

  1. Spike the Cloudflare driver if we need JS rendering.
  2. Add to /docs and /blog route groups first.
  3. Monitor cache hit rates and AI traffic impact."*

For Design/Product:

*"This lets us control how our content appears in AI tools—no more fighting bloated HTML. For example:

  • Docs: Serve clean markdown to Copilot/GPT for better code snippets.
  • Blogs: Ensure AI summaries capture key points without navigation clutter.
  • Support: AI agents can parse FAQs accurately.

No changes needed to your existing templates—just add a middleware or .md URL suffix. We can also use attributes to exclude sensitive pages (e.g., dashboards)."*

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