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
Parsedown Extra

Parsedown Extra Laravel Package

erusev/parsedown-extra

Parsedown Extra is a fast, lightweight PHP Markdown parser with built-in support for Markdown Extra features like tables, footnotes, definition lists, and fenced code blocks. Ideal for rendering user content safely and quickly in PHP apps.

View on GitHub
Deep Wiki
Context7

Markdown Extra Extension for Parsedown

Frequently asked questions about Parsedown Extra
How do I install Parsedown Extra in a Laravel project?
Run `composer require erusev/parsedown-extra` to install the package. It requires PHP 8.0+ and automatically pulls in the base Parsedown library. No additional Laravel-specific setup is needed unless you want to integrate it globally via a service provider.
Does this package support all Markdown Extra features like tables and fenced code blocks?
Yes, Parsedown Extra fully supports Markdown Extra extensions, including tables, footnotes, definition lists, and fenced code blocks. It’s built on top of Parsedown to ensure compatibility with these advanced syntaxes while keeping the output clean and predictable.
Can I use this in Laravel Blade templates?
Absolutely. You can register a Blade directive (e.g., `@markdown`) or use a facade to render Markdown directly in views. For example, create a `Markdown` facade pointing to the ParsedownExtra instance, then use `{{ markdown($content) }}` in your Blade files.
Is Parsedown Extra compatible with Laravel 10+?
Yes, the package supports PHP 8.0+, which aligns with Laravel’s LTS versions (including Laravel 10). It’s framework-agnostic but integrates seamlessly with Laravel’s dependency injection and service container.
How do I handle user-generated Markdown safely to avoid XSS?
Parsedown Extra outputs sanitized HTML by default, but for extra security, use Laravel’s `Str::of()` or `htmlspecialchars()` on the parsed output if the input is untrusted. Alternatively, integrate a package like `spatie/laravel-html` for stricter sanitization.
What’s the performance impact of using this in a high-traffic Laravel app?
Parsedown Extra is optimized for speed, with minimal overhead (~10KB). For high-traffic apps, cache the parsed HTML (e.g., using Laravel’s cache drivers) to avoid reprocessing Markdown on every request. Benchmark with your specific use case for exact metrics.
Can I extend Parsedown Extra with custom syntax (e.g., shortcodes)?
Yes, the package leverages Parsedown’s extension system. You can add custom syntax by creating a subclass of `ParsedownExtra` and registering your extensions via `setBreaksEnabled()`, `setMarkupEscaped()`, or by implementing custom `BlockParser`/`InlineParser` classes.
What’s the fallback strategy if Parsedown Extra fails in production?
If you need a fallback, instantiate a basic `Parsedown` instance (from `erusev/parsedown`) as a secondary parser. Wrap the primary Parsedown Extra logic in a try-catch block and return the fallback output if an exception occurs.
Does this package work with Laravel’s API responses?
Yes, you can use Parsedown Extra in API controllers to convert Markdown fields (e.g., `Post::content`) to HTML before returning JSON responses. Example: `return response()->json(['content' => Markdown::text($post->content)]);`.
Are there alternatives to Parsedown Extra for Laravel Markdown parsing?
Alternatives include `spatie/laravel-markdown` (which wraps Parsedown) or `league/commonmark` for CommonMark support. Parsedown Extra is lighter and more focused on Markdown Extra features, making it ideal for apps needing tables, footnotes, and definition lists without extra dependencies.
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.
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
anil/file-picker
broqit/fields-ai