PHPackages                             hasnayeen/mdb - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Templating &amp; Views](/categories/templating)
4. /
5. hasnayeen/mdb

ActiveLibrary[Templating &amp; Views](/categories/templating)

hasnayeen/mdb
=============

MDX for laravel blade

v1.0.0(2y ago)4321[4 PRs](https://github.com/Hasnayeen/mdb/pulls)1MITPHPPHP ^8.1CI passing

Since Aug 26Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/Hasnayeen/mdb)[ Packagist](https://packagist.org/packages/hasnayeen/mdb)[ Docs](https://github.com/hasnayeen/mdb)[ RSS](/packages/hasnayeen-mdb/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (12)Versions (6)Used By (1)

MDX for laravel blade
=====================

[](#mdx-for-laravel-blade)

[![Latest Version on Packagist](https://camo.githubusercontent.com/8dcd7588e1e51ca1188e80f199de8d03f34d0f86c7c18d432291c2be6c9f4540/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6861736e617965656e2f6d64622e737667)](https://packagist.org/packages/hasnayeen/mdb)[![GitHub Tests Action Status](https://camo.githubusercontent.com/38aef1d85a052b19a58fd6ab549dbd3f34ab265a7032ead4b8847534763fced5/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6861736e617965656e2f6d64622f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473)](https://github.com/hasnayeen/mdb/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/4b4d38fd4566c2a293af8cb0aca8bed8727d90458cafc8b5f6ebfd5c6eeb39b2/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6861736e617965656e2f6d64622f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65)](https://github.com/hasnayeen/mdb/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/1518e63b9802d6c266c53c35332a271ca1e1a8f3649cf3d609ea76d45e908d02/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6861736e617965656e2f6d64622e737667)](https://packagist.org/packages/hasnayeen/mdb)

This package allows you to use blade components in your markdown. If you're familiar with MDX format than this is same as MDX but with Laravel blade components.

Hire me
-------

[](#hire-me)

I'm available for contractual work on this stack (Filament, Laravel, Livewire, AlpineJS, TailwindCSS). Reach me via [email](searching.nehal@gmail.com) or [discord](discordapp.com/users/297318343642447872)

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require hasnayeen/mdb
```

Usage
-----

[](#usage)

Let's say you've a blade component like below

```

@props(['type' => 'info'])

merge(['class' => "alert alert-{{ $type }}"]) }}>
    {{ $slot }}

```

Use the component in your markdown component and convert to html with `render` method

```
$content = '
# Welcome to my blog

This is a success message.

This is a warning message.

This is a danger message.

';

Mdb::render($content);
```

Alternatively you can use `mdb` method on `Illuminate\Support\Str` class

```
Str::mdb($content);
```

You can also configure the underlying markdown converter by passing an array of options to the `render` method. Check [League\\CommonMark docs](https://commonmark.thephpleague.com/2.4/configuration/) for available options.

```
$content = '# MDB Demo';
$config = [
    'html_input' => 'allow',
    'allow_unsafe_links' => true,
    'max_nesting_level' => 4,
    'renderer' => 'block_separator',
];
Mdb::render($content, $config);
```

You can use additional [extension](https://commonmark.thephpleague.com/2.4/extensions/overview/) to use for markdown rendering by adding them to mdb config file.

```
    'extensions' => [
        'League\CommonMark\Extension\HeadingPermalink\HeadingPermalinkExtension',
    ]
```

This will add the [Heading Permalink](https://commonmark.thephpleague.com/2.4/extensions/heading-permalinks/) extension to turn all heading into permalink.

You can provide configuration for the extension by passing array to `render` method like before

```
$content = '# MDB Demo';
$config = [
    'heading_permalink' => [
        'html_class' => 'heading-permalink',
        'id_prefix' => 'content',
        'apply_id_to_heading' => false,
        'heading_class' => '',
        'fragment_prefix' => 'content',
        'insert' => 'before',
        'min_heading_level' => 1,
        'max_heading_level' => 6,
        'title' => 'Permalink',
        'symbol' => '#',
        'aria_hidden' => true,
    ],
];
Mdb::render($content, $config);
```

Testing
-------

[](#testing)

```
composer test

```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Hasnayeen](https://github.com/Hasnayeen)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance60

Regular maintenance activity

Popularity12

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

994d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/f9e1bc0a6f79bc25e6e5995238b3b2e5cfc76d4118d87377e0c45e984b707fb2?d=identicon)[Hasnayeen](/maintainers/Hasnayeen)

---

Top Contributors

[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (14 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (10 commits)")[![Hasnayeen](https://avatars.githubusercontent.com/u/9433499?v=4)](https://github.com/Hasnayeen "Hasnayeen (8 commits)")

---

Tags

laravelHasnayeenMDB

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/hasnayeen-mdb/health.svg)

```
[![Health](https://phpackages.com/badges/hasnayeen-mdb/health.svg)](https://phpackages.com/packages/hasnayeen-mdb)
```

###  Alternatives

[ryangjchandler/blade-capture-directive

Create inline partials in your Blade templates with ease.

8222.2M12](/packages/ryangjchandler-blade-capture-directive)[spatie/laravel-blade-comments

Add debug comments to your rendered output

177325.5k](/packages/spatie-laravel-blade-comments)[vormkracht10/laravel-mails

Laravel Mails can collect everything you might want to track about the mails that has been sent by your Laravel app.

24149.7k](/packages/vormkracht10-laravel-mails)[daikazu/laravel-glider

Start using Glide on-the-fly instantly in your Laravel blade templates.

882.3k](/packages/daikazu-laravel-glider)[combindma/dash-ui

A streamlined and stylish UI component library for Laravel Blade, crafted with TailwindCSS and AlpineJs for simplicity and elegance.

631.4k](/packages/combindma-dash-ui)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
