PHPackages                             hanssn/markdown - 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. [Framework](/categories/framework)
4. /
5. hanssn/markdown

ActiveLibrary[Framework](/categories/framework)

hanssn/markdown
===============

Markdown Is A CommonMark Wrapper For Laravel

15.2.x-dev(2y ago)05MITPHPPHP ^7.4.15 || 7.4.3 || ^8.0.2

Since May 2Pushed 2y agoCompare

[ Source](https://github.com/hanssn/Laravel-Markdown)[ Packagist](https://packagist.org/packages/hanssn/markdown)[ GitHub Sponsors](https://github.com/GrahamCampbell)[ Fund](https://tidelift.com/funding/github/packagist/graham-campbell/markdown)[ RSS](/packages/hanssn-markdown/feed)WikiDiscussions 15.2 Synced 1mo ago

READMEChangelogDependencies (9)Versions (1)Used By (0)

Laravel Markdown
================

[](#laravel-markdown)

Laravel Markdown was created by, and is maintained by [Graham Campbell](https://github.com/GrahamCampbell), and is a [CommonMark](https://github.com/thephpleague/commonmark) wrapper for [Laravel](https://laravel.com/). It ships with **integration with Laravel's view system** too. Feel free to check out the [change log](CHANGELOG.md), [releases](https://github.com/GrahamCampbell/Laravel-Markdown/releases), [security policy](https://github.com/GrahamCampbell/Laravel-Markdown/security/policy), [license](LICENSE), [code of conduct](.github/CODE_OF_CONDUCT.md), and [contribution guidelines](.github/CONTRIBUTING.md).

[![Banner](https://user-images.githubusercontent.com/2829600/71477505-680d0f80-27e2-11ea-94a6-b4bacb08e270.png)](https://user-images.githubusercontent.com/2829600/71477505-680d0f80-27e2-11ea-94a6-b4bacb08e270.png)

[![Build Status](https://camo.githubusercontent.com/3cf73859eba247a1423eda9a6f5e433409a3a8beaf16e78238a657cbffb195ac/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f47726168616d43616d7062656c6c2f4c61726176656c2d4d61726b646f776e2f74657374732e796d6c3f6c6162656c3d5465737473267374796c653d666c61742d737175617265)](https://github.com/GrahamCampbell/Laravel-Markdown/actions?query=workflow%3ATests)[![StyleCI Status](https://camo.githubusercontent.com/24bdbe6d3d51f73e34f48b2c1c224208579b7946e2e4a9807dce687232dffa1a/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f31353039303638372f736869656c64)](https://github.styleci.io/repos/15090687)[![Software License](https://camo.githubusercontent.com/c090e080484e2a2bc766446291d04437db823929042bf614b26a1643660ddf6f/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e3f7374796c653d666c61742d737175617265)](LICENSE)[![Packagist Downloads](https://camo.githubusercontent.com/aed17e72e0f124d7beb44db8e5c4362bea0559ec159c7951296a5aeb6a5cb23a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f67726168616d2d63616d7062656c6c2f6d61726b646f776e3f7374796c653d666c61742d737175617265)](https://packagist.org/packages/graham-campbell/markdown)[![Latest Version](https://camo.githubusercontent.com/740f2510189a3862caf84432f6a3af8fadb23b9fb68be781fcd90860b744ed87/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f47726168616d43616d7062656c6c2f4c61726176656c2d4d61726b646f776e3f7374796c653d666c61742d737175617265)](https://github.com/GrahamCampbell/Laravel-Markdown/releases)

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

[](#installation)

This version requires [PHP](https://www.php.net/) 7.4-8.3 and supports [Laravel](https://laravel.com/) 8-11.

MarkdownL5.5L5.6L5.7L5.8L6L7L8L9L10L1110.3✅✅✅✅❌❌❌❌❌❌11.2✅✅✅✅✅✅❌❌❌❌12.0❌❌❌❌✅✅❌❌❌❌13.1❌❌❌❌✅✅✅❌❌❌14.0❌❌❌❌❌❌✅✅❌❌15.2❌❌❌❌❌❌✅✅✅✅To get the latest version, simply require the project using [Composer](https://getcomposer.org/):

```
$ composer require "graham-campbell/markdown:^15.2"
```

Once installed, if you are not using automatic package discovery, then you need to register the `GrahamCampbell\Markdown\MarkdownServiceProvider` service provider in your `config/app.php`.

You can also optionally alias our facade:

```
        'Markdown' => GrahamCampbell\Markdown\Facades\Markdown::class,
```

Configuration
-------------

[](#configuration)

Laravel Markdown supports optional configuration.

To get started, you'll need to publish all vendor assets:

```
$ php artisan vendor:publish
```

This will create a `config/markdown.php` file in your app that you can modify to set your configuration. Also, make sure you check for changes to the original config file in this package between releases.

There are several config options:

##### Enable View Integration

[](#enable-view-integration)

This option (`'views'`) specifies if the view integration is enabled so you can write markdown views and have them rendered as html. The following extensions are currently supported: `'.md'`, `'.md.php'`, and `'.md.blade.php'`. Additionally, this will enable the `@markdown` Blade directive. You may disable this integration if it is conflicting with another package. The default value for this setting is `true`.

##### CommonMark Extensions

[](#commonmark-extensions)

This option (`'extensions'`) specifies what extensions will be automatically enabled. Simply provide your extension class names here, and they will be resolved from the service container, and registered with CommonMark. The default value for this setting is `[League\CommonMark\Extension\CommonMark\CommonMarkCoreExtension::class, League\CommonMark\Extension\Table\TableExtension::class]`.

##### Renderer Configuration

[](#renderer-configuration)

This option (`'renderer'`) specifies an array of options for rendering HTML. The default value for this setting is `['block_separator' => "\n", 'inner_separator' => "\n", 'soft_break' => "\n"]`.

##### CommonMark Configuration

[](#commonmark-configuration)

This option (`'commonmark'`) specifies an array of options for commonmark. The default value for this setting is `['enable_em' => true, 'enable_strong' => true, 'use_asterisk' => true, 'use_underscore' => true, 'unordered_list_markers' => ['-', '+', '*']]`.

##### HTML Input

[](#html-input)

This option (`'html_input'`) specifies how to handle untrusted HTML input. The default value for this setting is `'strip'`.

##### Allow Unsafe Links

[](#allow-unsafe-links)

This option (`'allow_unsafe_links'`) specifies whether to allow risky image URLs and links. The default value for this setting is `true`.

##### Maximum Nesting Level

[](#maximum-nesting-level)

This option (`'max_nesting_level'`) specifies the maximum permitted block nesting level. The default value for this setting is `PHP_INT_MAX`.

##### Slug Normalizer

[](#slug-normalizer)

This option (`'slug_normalizer'`) specifies an array of options for slug normalization. The default value for this setting is `['max_length' => 255, 'unique' => 'document']`.

Usage
-----

[](#usage)

##### Facades\\Markdown

[](#facadesmarkdown)

This facade will dynamically pass static method calls to the `'markdown.converter'` object in the ioc container which by default is an instance of `League\CommonMark\ConverterInterface`.

##### MarkdownServiceProvider

[](#markdownserviceprovider)

This class contains no public methods of interest. This class should be added to the providers array in `config/app.php`. This class will setup ioc bindings.

##### Real Examples

[](#real-examples)

Here you can see an example of just how simple this package is to use.

```
use GrahamCampbell\Markdown\Facades\Markdown;

Markdown::convert('foo')->getContent(); // foo
```

If you prefer to use dependency injection over facades like me, then you can easily inject the class like so:

```
use League\CommonMark\ConverterInterface;

class Foo
{
    private ConverterInterface $converter;

    public function __construct(ConverterInterface $converter)
    {
        $this->converter = $converter;
    }

    public function bar(): string
    {
        return $this->converter->convert('foo')->getContent();
    }
}

app(Foo::class)->bar();
```

And don't forget, that's just the basics. We also support extension through listening for the resolving event from the container, and we ship with integration with Laravel's view system. You can use both the `@markdown` blade directive, and also using the following file extensions will compile your views as markdown: `'.md'`, `'.md.php'`, and `'.md.blade.php'`.

For example, the following are all methods of rendering markdown:

*`foo.blade.php`*:

```
@markdown('# Foo')
```

*`bar.blade.php`*:

```
@markdown
# Bar
@endmarkdown
```

*`baz1.md`*:

```
# Baz 1

```

*`baz2.md.php`*:

```
# Baz 2

```

*`baz3.md.blade.php`*:

```
# Baz 3

```

##### Further Information

[](#further-information)

There are other classes in this package that are not documented here (such as the engine and compiler classes). This is because they are not intended for public use and are used internally by this package.

### Extensions

[](#extensions)

As hinted in the configuration docs, CommonMark can be modified using extensions. There are some very good examples in the customization section of the CommonMark docs for how to create custom parsers and renders in the customization section: .

Security
--------

[](#security)

If you discover a security vulnerability within this package, please send an email to . All security vulnerabilities will be promptly addressed. You may view our full security policy [here](https://github.com/GrahamCampbell/Laravel-Markdown/security/policy).

License
-------

[](#license)

Laravel Markdown is licensed under [The MIT License (MIT)](LICENSE).

For Enterprise
--------------

[](#for-enterprise)

Available as part of the Tidelift Subscription

The maintainers of `graham-campbell/markdown` and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/packagist-graham-campbell-markdown?utm_source=packagist-graham-campbell-markdown&utm_medium=referral&utm_campaign=enterprise&utm_term=repo)

###  Health Score

17

—

LowBetter than 6% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity30

Early-stage or recently created project

 Bus Factor1

Top contributor holds 97.2% of commits — single point of failure

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

746d ago

### Community

Maintainers

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

---

Top Contributors

[![GrahamCampbell](https://avatars.githubusercontent.com/u/2829600?v=4)](https://github.com/GrahamCampbell "GrahamCampbell (411 commits)")[![colinodell](https://avatars.githubusercontent.com/u/202034?v=4)](https://github.com/colinodell "colinodell (2 commits)")[![baijunyao](https://avatars.githubusercontent.com/u/9360694?v=4)](https://github.com/baijunyao "baijunyao (1 commits)")[![bbashy](https://avatars.githubusercontent.com/u/1149200?v=4)](https://github.com/bbashy "bbashy (1 commits)")[![danhunsaker](https://avatars.githubusercontent.com/u/1534396?v=4)](https://github.com/danhunsaker "danhunsaker (1 commits)")[![m1guelpf](https://avatars.githubusercontent.com/u/23558090?v=4)](https://github.com/m1guelpf "m1guelpf (1 commits)")[![mmachatschek](https://avatars.githubusercontent.com/u/10237069?v=4)](https://github.com/mmachatschek "mmachatschek (1 commits)")[![nazar-pc](https://avatars.githubusercontent.com/u/928965?v=4)](https://github.com/nazar-pc "nazar-pc (1 commits)")[![tevfik6](https://avatars.githubusercontent.com/u/1277211?v=4)](https://github.com/tevfik6 "tevfik6 (1 commits)")[![aaronteamxyz](https://avatars.githubusercontent.com/u/209986197?v=4)](https://github.com/aaronteamxyz "aaronteamxyz (1 commits)")[![vaughany](https://avatars.githubusercontent.com/u/381767?v=4)](https://github.com/vaughany "vaughany (1 commits)")[![aidabeorn](https://avatars.githubusercontent.com/u/219796?v=4)](https://github.com/aidabeorn "aidabeorn (1 commits)")

---

Tags

frameworklaravelmarkdownGraham CampbellGrahamCampbellcommonmarkLaravel-Markdowncommon mark

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/hanssn-markdown/health.svg)

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

###  Alternatives

[graham-campbell/markdown

Markdown Is A CommonMark Wrapper For Laravel

1.3k7.1M64](/packages/graham-campbell-markdown)[graham-campbell/manager

Manager Provides Some Manager Functionality For Laravel

39221.1M134](/packages/graham-campbell-manager)[graham-campbell/exceptions

Provides A Powerful Error Response System For Both Development And Production

5911.3M4](/packages/graham-campbell-exceptions)[graham-campbell/digitalocean

DigitalOcean Is A DigitalOcean Bridge For Laravel

509343.1k2](/packages/graham-campbell-digitalocean)[graham-campbell/bitbucket

Bitbucket Is A Bitbucket Bridge For Laravel

75185.0k2](/packages/graham-campbell-bitbucket)

PHPackages © 2026

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