ryangjchandler/commonmark-blade-block
Embed Laravel Blade code inside of your Markdown templates.
Maintainers
Package info
github.com/ryangjchandler/commonmark-blade-block
pkg:composer/ryangjchandler/commonmark-blade-block
Fund package maintenance!
Requires
- php: ^8.2
- illuminate/contracts: ^12.0 | ^13.0
- league/commonmark: ^2.7
- spatie/laravel-package-tools: ^1.92.4
Requires (Dev)
- larastan/larastan: ^3.0
- laravel/pint: ^1.22.1
- nunomaduro/collision: ^8.0
- orchestra/testbench: ^10.0.0 | ^11.0
- pestphp/pest: ^4.0
- pestphp/pest-plugin-arch: ^4.0
- pestphp/pest-plugin-laravel: ^4.0
- phpstan/extension-installer: ^1.4.3
- phpstan/phpstan-deprecation-rules: ^2.0
- phpstan/phpstan-phpunit: ^2.0
- spatie/laravel-ray: ^1.40.2
Suggests
None
Provides
None
Conflicts
None
Replaces
None
MIT b72a9bfb7c70862d162f8779cf94b3c792cee8e7
- Ryan Chandler <support.woop@ryangjchandler.co.uk>
This package is auto-updated.
Last update: 2026-06-22 02:13:03 UTC
README
👁 Latest Version on Packagist
👁 GitHub Tests Action Status
👁 GitHub Code Style Action Status
👁 Total Downloads
This package provides an extension for league/commonmark that lets you embed Laravel Blade code inside of your Markdown content.
Installation
You can install the package via Composer:
composer require ryangjchandler/commonmark-blade-block
Usage
Start by registering the extension.
use League\CommonMark\MarkdownConverter; use League\CommonMark\Environment\Environment; use League\CommonMark\Extension\CommonMark\CommonMarkCoreExtension; use RyanChandler\CommonmarkBladeBlock\BladeExtension; $environment = new Environment(); $environment ->addExtension(new CommonMarkCoreExtension) ->addExtension(new BladeExtension); $converter = new MarkdownConverter($environment);
Then start embedding Blade inside of your Markdown content with the @blade and @endblade tags.
# Hello, world! @blade <x-button> Click me! </x-button> @endblade
Using Laravel's Str or str() helpers
If you're using Str::markdown() or str()->markdown(), then you can register the extension through the extensions argument.
Str::markdown( <<<'MD' @blade <x-button></x-button> @endblade MD, extensions: [ new BladeExtension(), ] )
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.
