Weave 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 Laravel Package

parsedown/laravel

Parsedown Laravel integrates the fast Parsedown Markdown parser with Laravel, offering a simple facade and service provider to convert Markdown to HTML. Configure safe mode and custom extensions easily in your views, controllers, or Blade templates.

View on GitHub
Deep Wiki
Context7

Getting Started

This release targets PHP >= 7.2.3, so bump your composer.json platform requirement (and any CI images) before upgrading.

  1. Install/upgrade the package as usual (composer require <vendor>/<package>), then publish the new config file:
    php artisan vendor:publish --tag=parsedown
    
    The package works without publishing — the shipped defaults are used — but publishing is now the intended way to configure the singleton.
  2. Look first at config/parsedown.php. Every option you see there is applied to the singleton returned by the parsedown() helper.
  3. First use case: render markdown in a controller or view.
    $html = parsedown('# Hello');          // block-level parse, wrapped in <p> etc.
    $html = parsedown('# Hello', true);    // inline parse, no block wrapper
    
  4. In Blade:
    @parsedown($post->body)
    @parsedown($post->title, true)
    

If you need the raw Parsedown object (custom extension, manual calls), call the helper with no arguments:

$parser = parsedown();       // configured singleton
$parser->text($markdown);

Implementation Patterns

Config-driven singleton. Treat config/parsedown.php as the single source of truth for parser behaviour (breaks, markup escaping, URL handling, safe mode, etc.). The helper builds and configures one Parsedown instance from this file; keep environment-specific tweaks in .env-backed config values rather than mutating the object at runtime.

Blade directive for display. Use @parsedown($markdown) in views for long-form content, and @parsedown($string, true) for short, inline fragments such as post titles, table cells, tooltips, or headings where the extra <p> wrapper would break layout.

Helper in application code. For content assembled in controllers, mailables, or API resources, parsedown($text) and parsedown($text, true) keep call sites short. Reserve the zero-argument form for cases where you genuinely need the object:

$parser = parsedown();
$parser->setMarkupEscaped(true);
return $parser->text($userInput);

Container injection. Because the helper returns a singleton, you can also type-hint Parsedown in constructors and methods and let the container hand you the configured instance — useful for testability and for services that render markdown repeatedly.

Safe rendering of user content. For any untrusted input, enable the safe-mode/markup-escaping options in the config rather than post-processing the HTML. This is the cleanest integration point and applies uniformly to the helper, the Blade directive, and injected instances.

Custom extensions. Subclass Parsedown (or use its inline/block extension hooks) and bind your subclass in a service provider so the singleton resolution picks it up; keep the config file responsible for the built-in options and the subclass responsible for structural changes.

Testing. Assert on rendered output from the helper/directive rather than on parser internals, and add a test that the published config values are actually applied — that catches config-cache and publish-tag mistakes early.

Gotchas and Tips

  • The singleton is mutable and shared. Calling parsedown() and then changing options (e.g. setBreaksEnabled(true)) mutates the instance for the rest of the request — including later @parsedown calls and injected instances. Configure via the config file, or instantiate a fresh Parsedown when you need a one-off variant.
  • No-argument calls are not fresh instances. parsedown() always gives you the same configured object; don't assume it is unconfigured because you didn't pass markdown.
  • Blade output is raw. The directive echoes parsed HTML, so it is not escaped the way {{ }} is. Sanitise or enable safe mode before rendering untrusted markdown; this is the most common source of XSS in markdown-backed Laravel apps.
  • Inline mode changes semantics. Passing true omits the block wrapper but still runs inline parsing — block constructs (lists, fenced code, tables) inside an inline call won't render as you expect. Use it only for genuinely inline fragments.
  • Config caching. After editing config/parsedown.php, run php artisan config:clear (or re-run config:cache) in cached environments; otherwise your changes silently won't take effect.
  • Publishing is optional but sticky. If you don't publish, future package releases can change defaults and therefore your output. Publish and commit the config if output stability matters.
  • PHP 7.2.3 minimum. Older PHP 7.1/7.2.x patch levels will fail the Composer platform check; update CI matrices and Docker base images at the same time to avoid a split between local and deployed behaviour.
  • Debugging. parsedown() with no arguments is the fastest way to inspect the live configuration (var_dump(parsedown())) and confirm the config file is being read as expected.
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.
3mdikram/worldmoneywords
snowsoft/config
itmosoft/laravel-subscriptions
larva/laravel-ai-qwen
diephp/sequences
users-au/socialite-provider
twidpay/twid-logger
mrnewport/laravel-plaid
mrnewport/laravel-repo
mrnewport/laravel-docsign
mrnewport/laravel-stow
mrnewport/laravel-flow
mrnewport/laravel-priceable
mrnewport/laravel-nestedterms
fredmeng/laravel-apidoc-generator
itstructure/laravel-multilingual-tools
pdustdar/elasticsearch
markupai/php-sdk
rlacerda83/lumem-microservice-shipment
uni-method/symfony-lib