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

Markdown Extra Laravel Package

twig/markdown-extra

Twig extension adding Markdown support to templates. Provides markdown_to_html and html_to_markdown filters to convert Markdown blocks to HTML and turn HTML back into Markdown, making it easy to render or edit rich content in Twig views.

View on GitHub
Deep Wiki
Context7

A Twig extension for Markdown

Frequently asked questions about Markdown Extra
Can I use twig/markdown-extra in Laravel without Twig?
No, this package requires Twig as a dependency. Laravel projects using Blade will need a Twig bridge like `tightenco/jigsaw`, but alternatives like `cebe/markdown` or Laravel’s native `Str::markdown()` are simpler and Blade-compatible.
Is twig/markdown-extra safe for user-generated Markdown content?
No, it lacks built-in sanitization, exposing XSS risks when converting Markdown to HTML. Always sanitize output (e.g., with `html-sanitizer`) and validate input. Consider alternatives like `league/commonmark` for stricter security.
How do I install twig/markdown-extra in a Laravel project?
Run `composer require twig/markdown-extra` and register the extension in your Twig environment (e.g., via a service provider). For Laravel, ensure Twig is properly configured first, as this package isn’t Blade-native.
Does twig/markdown-extra support Laravel 10+?
Officially, no—it’s designed for Twig/Symfony ecosystems. Laravel 10+ may face compatibility issues due to Twig v3.x changes. Test thoroughly or use a fork if critical. For Laravel, `cebe/markdown` is a more reliable choice.
What’s the difference between markdown_to_html and html_to_markdown?
`markdown_to_html` converts Markdown to HTML (e.g., for rendering user content), while `html_to_markdown` reverses the process (e.g., for editing workflows). The latter may lose complex HTML structures like tables or scripts.
Is twig/markdown-extra actively maintained?
No, the package has no recent updates, zero dependents, and a suspicious 2026 release date. Forking may be necessary, but long-term support is uncertain. Evaluate alternatives like `league/commonmark` for stability.
Will twig/markdown-extra work with Laravel’s Blade templates?
No, this package is Twig-only. For Blade, use `Str::markdown()` (built-in) or `cebe/markdown` (lightweight). If you *must* use Twig in Laravel, consider `tightenco/jigsaw` but expect architectural trade-offs.
How do I cache Markdown-to-HTML conversions for performance?
Cache the filtered output in Twig (e.g., `{% cache %}` blocks) or pre-render Markdown in your controller. Avoid per-request parsing for high-traffic sites, as this package adds latency without built-in caching.
Are there better alternatives for Laravel Markdown support?
Yes. For Blade: `cebe/markdown` (simple) or `league/commonmark` (full CommonMark). For Twig: `twig/markdown-extra` is fine, but evaluate its unmaintained risks. Laravel’s `Str::markdown()` is sufficient for basic use cases.
How do I handle bidirectional Markdown workflows in Laravel?
If you need both directions, `twig/markdown-extra` works in Twig but isn’t Laravel-native. For Blade, combine `cebe/markdown` (Markdown→HTML) with a custom HTML→Markdown solution (e.g., `league/html-to-markdown`). Test edge cases like nested tables or scripts.
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