PHPackages                             spatie/laravel-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. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. spatie/laravel-markdown

ActiveLibrary[Parsing &amp; Serialization](/categories/parsing)

spatie/laravel-markdown
=======================

A highly configurable markdown renderer and Blade component for Laravel

2.8.0(2mo ago)4053.4M↓12.1%3220MITPHPPHP ^8.1CI passing

Since Jul 11Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/spatie/laravel-markdown)[ Packagist](https://packagist.org/packages/spatie/laravel-markdown)[ Docs](https://github.com/spatie/laravel-markdown)[ GitHub Sponsors](https://github.com/spatie)[ RSS](/packages/spatie-laravel-markdown/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (15)Versions (36)Used By (20)

 [   ![Logo for laravel-markdown](https://camo.githubusercontent.com/3af322d94c0d324dff8cf9e9000710d8db895656ccb5668ff74175fe8ae7a9cb/68747470733a2f2f7370617469652e62652f7061636b616765732f6865616465722f6c61726176656c2d6d61726b646f776e2f68746d6c2f6c696768742e77656270)  ](https://spatie.be/open-source?utm_source=github&utm_medium=banner&utm_campaign=laravel-markdown)Markdown renderer and Blade component for Laravel
=================================================

[](#markdown-renderer-and-blade-component-for-laravel)

[![Latest Version on Packagist](https://camo.githubusercontent.com/507669fade7b6c0018ba950e72c7e39597e5d004d7b2cf357b0cffd6f2ad4960/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7370617469652f6c61726176656c2d6d61726b646f776e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/spatie/laravel-markdown)[![GitHub Tests Action Status](https://camo.githubusercontent.com/18714ed03c93927922523de2ec75d1bbc29214eaa9ae05974ccd8ac61104893f/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f7370617469652f6c61726176656c2d6d61726b646f776e2f72756e2d74657374732e796d6c3f6c6162656c3d5465737473266272616e63683d6d61696e)](https://github.com/spatie/laravel-markdown/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/12717bcb0c4aadb701355413b29d03fa5b81b5947913441cdaeaa14a25914b5d/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f7370617469652f6c61726176656c2d6d61726b646f776e2f7068702d63732d66697865722e796d6c3f6c6162656c3d436f64652532305374796c65266272616e63683d6d61696e)](https://github.com/spatie/laravel-markdown/actions?query=workflow%3A%22Check+%26+fix+styling%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/e705a7c59782ab7fec36e8603e74a1589f78a933559a4518db22ccf6a2b5b969/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7370617469652f6c61726176656c2d6d61726b646f776e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/spatie/laravel-markdown)

This package contains:

- a Blade component that can render markdown
- a highly configurable class that you can use to render markdown

Let's start with an example of the provided `x-markdown` Blade component. This chunk of markdown...

```

# My title

This is a [link to our website](https://spatie.be)

```php
echo 'Hello world';
```

```

... will be converted by to component to this chunk of HTML:

```

    My title
    This is a link to our website
    echo &#39;Hello world&#39;;

```

You can also programmatically render HTML.

```
// by resolving the class out of the container all the options
// in the config file will be used.

app(Spatie\LaravelMarkdown\MarkdownRenderer::class)->toHtml($markdown);
```

Out of the box, the `x-markdown` component and `MarkdownRenderer` can:

- highlight code blocks correctly (via [Shiki PHP](https://github.com/spatie/shiki-php)) for 100+ languages, including PHP, JS, Blade, [and many more](https://github.com/shikijs/shiki/blob/main/docs/languages.md).
- add anchor links to headings
- cache results to increase performance

Support us
----------

[](#support-us)

[![](https://camo.githubusercontent.com/527189a9b259a100e2f39f59e6c6f216836724cdfd8c040aaaae060dfa5f61b1/68747470733a2f2f6769746875622d6164732e73332e65752d63656e7472616c2d312e616d617a6f6e6177732e636f6d2f6c61726176656c2d6d61726b646f776e2e6a70673f743d31)](https://spatie.be/github-ad-click/laravel-markdown)

We invest a lot of resources into creating [best in class open source packages](https://spatie.be/open-source). You can support us by [buying one of our paid products](https://spatie.be/open-source/support-us).

We highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using. You'll find our address on [our contact page](https://spatie.be/about-us). We publish all received postcards on [our virtual postcard wall](https://spatie.be/open-source/postcards).

Documentation
-------------

[](#documentation)

You can find installation instructions and detailed instructions on how to use this package at [the dedicated documentation site](https://docs.spatie.be/laravel-markdown/v1/introduction/).

Related packages
----------------

[](#related-packages)

If you only need the league/commonmark extension to highlight code, head over to [spatie/commonmark-shiki-highlighter](https://github.com/spatie/commonmark-shiki-highlighter).

In case you don't need the markdown support, but want to highlight code directly, take a look at [spatie/shiki-php](https://github.com/spatie/shiki-php).

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

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

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

[](#contributing)

Please see [CONTRIBUTING](https://github.com/spatie/.github/blob/main/CONTRIBUTING.md) for details.

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

[](#security-vulnerabilities)

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

Credits
-------

[](#credits)

- [Freek Van der Herten](https://github.com/freekmurze)
- [All Contributors](../../contributors)

Alternatives
------------

[](#alternatives)

If you don't want to install and handle Shiki yourself, take a look at [Torchlight](https://torchlight.dev), which can highlight your code with minimal setup.

License
-------

[](#license)

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

###  Health Score

67

—

FairBetter than 100% of packages

Maintenance83

Actively maintained with recent releases

Popularity63

Solid adoption and visibility

Community38

Small or concentrated contributor base

Maturity72

Established project with proven stability

 Bus Factor1

Top contributor holds 60.5% 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

Every ~52 days

Recently: every ~167 days

Total

33

Last Release

86d ago

Major Versions

0.0.3 → 1.0.02021-07-12

1.1.3 → 2.0.02021-09-12

PHP version history (2 changes)0.0.1PHP ^8.0

2.5.0PHP ^8.1

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/7535935?v=4)[Spatie](/maintainers/spatie)[@spatie](https://github.com/spatie)

---

Top Contributors

[![freekmurze](https://avatars.githubusercontent.com/u/483853?v=4)](https://github.com/freekmurze "freekmurze (153 commits)")[![mallardduck](https://avatars.githubusercontent.com/u/619938?v=4)](https://github.com/mallardduck "mallardduck (20 commits)")[![riasvdv](https://avatars.githubusercontent.com/u/3626559?v=4)](https://github.com/riasvdv "riasvdv (11 commits)")[![timvandijck](https://avatars.githubusercontent.com/u/4528796?v=4)](https://github.com/timvandijck "timvandijck (8 commits)")[![erikn69](https://avatars.githubusercontent.com/u/4933954?v=4)](https://github.com/erikn69 "erikn69 (7 commits)")[![AdrianMrn](https://avatars.githubusercontent.com/u/12762044?v=4)](https://github.com/AdrianMrn "AdrianMrn (5 commits)")[![AyoobMH](https://avatars.githubusercontent.com/u/37803924?v=4)](https://github.com/AyoobMH "AyoobMH (4 commits)")[![laravel-shift](https://avatars.githubusercontent.com/u/15991828?v=4)](https://github.com/laravel-shift "laravel-shift (4 commits)")[![alxndrmlr](https://avatars.githubusercontent.com/u/579553?v=4)](https://github.com/alxndrmlr "alxndrmlr (4 commits)")[![fkellner](https://avatars.githubusercontent.com/u/28141677?v=4)](https://github.com/fkellner "fkellner (4 commits)")[![jimirobaer](https://avatars.githubusercontent.com/u/8984769?v=4)](https://github.com/jimirobaer "jimirobaer (3 commits)")[![benjamincrozat](https://avatars.githubusercontent.com/u/3613731?v=4)](https://github.com/benjamincrozat "benjamincrozat (3 commits)")[![MortenDHansen](https://avatars.githubusercontent.com/u/5455310?v=4)](https://github.com/MortenDHansen "MortenDHansen (3 commits)")[![SimonJulian](https://avatars.githubusercontent.com/u/22329077?v=4)](https://github.com/SimonJulian "SimonJulian (3 commits)")[![WendellAdriel](https://avatars.githubusercontent.com/u/11641518?v=4)](https://github.com/WendellAdriel "WendellAdriel (3 commits)")[![alexmanase](https://avatars.githubusercontent.com/u/10696975?v=4)](https://github.com/alexmanase "alexmanase (2 commits)")[![Erulezz](https://avatars.githubusercontent.com/u/6772197?v=4)](https://github.com/Erulezz "Erulezz (2 commits)")[![AshboDev](https://avatars.githubusercontent.com/u/14421977?v=4)](https://github.com/AshboDev "AshboDev (2 commits)")[![AlexVanderbist](https://avatars.githubusercontent.com/u/6287961?v=4)](https://github.com/AlexVanderbist "AlexVanderbist (2 commits)")[![nessimabadi](https://avatars.githubusercontent.com/u/11637110?v=4)](https://github.com/nessimabadi "nessimabadi (1 commits)")

---

Tags

codehighlightlaravelmarkdownphpspatielaravelLaravel-Markdown

###  Code Quality

TestsPest

Static AnalysisPsalm

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[graham-campbell/markdown

Markdown Is A CommonMark Wrapper For Laravel

1.3k7.1M64](/packages/graham-campbell-markdown)[spatie/laravel-responsecache

Speed up a Laravel application by caching the entire response

2.8k8.2M51](/packages/spatie-laravel-responsecache)[laravel/pulse

Laravel Pulse is a real-time application performance monitoring tool and dashboard for your Laravel application.

1.7k12.1M99](/packages/laravel-pulse)[spatie/laravel-health

Monitor the health of a Laravel application

86910.0M83](/packages/spatie-laravel-health)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9682.1M97](/packages/roots-acorn)[spatie/laravel-livewire-wizard

Build wizards using Livewire

4061.0M4](/packages/spatie-laravel-livewire-wizard)

PHPackages © 2026

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