PHPackages                             jeffersongoncalves/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. jeffersongoncalves/laravel-markdown

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

jeffersongoncalves/laravel-markdown
===================================

A shared CommonMark renderer for Laravel with GitHub Flavored Markdown, optional heading permalinks, and server-side syntax highlighting (class-based tokens) via tempest/highlight. Safe by default: raw HTML is escaped unless you opt in to html\_input=allow for trusted content. Requires PHP 8.4 because the syntax highlighter tempest/highlight requires it from 2.26 onward.

v2.0.0(1mo ago)158MITPHPPHP ^8.4CI passing

Since Jun 20Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/jeffersongoncalves/laravel-markdown)[ Packagist](https://packagist.org/packages/jeffersongoncalves/laravel-markdown)[ Docs](https://github.com/jeffersongoncalves/laravel-markdown)[ GitHub Sponsors](https://github.com/jeffersongoncalves)[ RSS](/packages/jeffersongoncalves-laravel-markdown/feed)WikiDiscussions master Synced 2w ago

READMEChangelog (4)Dependencies (9)Versions (6)Used By (0)

[![Laravel Markdown](https://raw.githubusercontent.com/jeffersongoncalves/laravel-markdown/master/art/jeffersongoncalves-laravel-markdown.png)](https://raw.githubusercontent.com/jeffersongoncalves/laravel-markdown/master/art/jeffersongoncalves-laravel-markdown.png)

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

[](#laravel-markdown)

[![Latest Version on Packagist](https://camo.githubusercontent.com/192a42b7fd342c1efe7d79fc81834e008734290edaffd254b5a43708b1adf25a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6a6566666572736f6e676f6e63616c7665732f6c61726176656c2d6d61726b646f776e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/jeffersongoncalves/laravel-markdown)[![GitHub Tests Action Status](https://camo.githubusercontent.com/43208e47757687a22150d37d9b1fc8819b01355c2611f93e4e49a8174495c2e0/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6a6566666572736f6e676f6e63616c7665732f6c61726176656c2d6d61726b646f776e2f72756e2d74657374732e796d6c3f6272616e63683d6d6173746572266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/jeffersongoncalves/laravel-markdown/actions?query=workflow%3Arun-tests+branch%3Amaster)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/41d92bcd8b0990ed44e454f46f6944e2a5438200cf1fac285edc03eb47ab3e2b/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6a6566666572736f6e676f6e63616c7665732f6c61726176656c2d6d61726b646f776e2f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d6173746572266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/jeffersongoncalves/laravel-markdown/actions?query=workflow%3A%22Fix+PHP+code+styling%22+branch%3Amaster)[![Total Downloads](https://camo.githubusercontent.com/7932e71a0ba0c5e6ab109ebd171ea36be0f29467d56b655a774023ff98a9aa5d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6a6566666572736f6e676f6e63616c7665732f6c61726176656c2d6d61726b646f776e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/jeffersongoncalves/laravel-markdown)

A shared CommonMark renderer for Laravel with GitHub Flavored Markdown, optional heading permalinks, and server-side syntax highlighting on fenced code blocks. Highlighting is class-based (`` tokens via [tempest/highlight](https://github.com/tempestphp/highlight)'s `CssTheme`) so the markup survives HTML sanitisation — you style the `.hl-*` classes in your own CSS.

The renderer is **safe by default**: raw HTML in the markdown source is escaped, so untrusted input cannot inject live markup such as ``.

Requirements
------------

[](#requirements)

This package requires **PHP 8.4+**. The floor is inherited from the syntax highlighter [tempest/highlight](https://github.com/tempestphp/highlight), which requires PHP 8.4 from version 2.26 onward; the rest of the package would run on PHP 8.2/8.3, but the highlighter does not, so the package as a whole targets PHP 8.4.

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

[](#installation)

You can install the package via composer:

```
composer require jeffersongoncalves/laravel-markdown
```

You can publish the config file with:

```
php artisan vendor:publish --tag="markdown-config"
```

This is the contents of the published config file:

```
return [
    'html_input' => 'escape',
    'allow_unsafe_links' => false,
    'heading_permalink' => [
        'symbol' => '#',
        'html_class' => 'md-anchor',
    ],
];
```

Usage
-----

[](#usage)

```
use JeffersonGoncalves\Markdown\Markdown;

// Render GitHub Flavored Markdown to HTML
$html = Markdown::render('# Hello **world**');

// Enable heading permalink anchors (adds  to each heading)
$html = Markdown::render($readme, headingPermalinks: true);
```

Fenced code blocks are highlighted server-side and emit class-based tokens:

```
$html = Markdown::render( 'allow',
```

Warning

With `html_input` set to `allow`, raw HTML in the source is preserved and **the output is UNSAFE** for untrusted input. In that mode you MUST pass the output through an HTML sanitizer such as [jeffersongoncalves/laravel-html-sanitizer](https://github.com/jeffersongoncalves/laravel-html-sanitizer) before displaying it. Class-based highlight tokens are designed to survive sanitisation; inline-style highlighting would not.

You can also set `html_input` to `strip` to remove raw HTML entirely.

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

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

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

[](#contributing)

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

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

[](#security-vulnerabilities)

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

Credits
-------

[](#credits)

- [Jèfferson Gonçalves](https://github.com/jeffersongoncalves)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

45

—

FairBetter than 91% of packages

Maintenance91

Actively maintained with recent releases

Popularity13

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 90.9% 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 ~0 days

Total

4

Last Release

44d ago

Major Versions

v1.0.2 → v2.0.02026-06-21

PHP version history (2 changes)v1.0.0PHP ^8.2

v1.0.1PHP ^8.4

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/411493?v=4)[Jefferson Gonçalves](/maintainers/jeffersongoncalves)[@jeffersongoncalves](https://github.com/jeffersongoncalves)

---

Top Contributors

[![jeffersongoncalves](https://avatars.githubusercontent.com/u/411493?v=4)](https://github.com/jeffersongoncalves "jeffersongoncalves (10 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")

---

Tags

commonmarkcomposergfmjeffersongoncalveslaravellaravel-packagemarkdownphpsyntax-highlightinglaraveljeffersongoncalvesLaravel-Markdown

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

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

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

###  Alternatives

[spatie/laravel-medialibrary

Associate files with Eloquent models

6.2k45.4M679](/packages/spatie-laravel-medialibrary)[tempest/framework

The PHP framework that gets out of your way.

2.3k37.6k19](/packages/tempest-framework)[spatie/laravel-health

Monitor the health of a Laravel application

88212.7M180](/packages/spatie-laravel-health)[harris21/laravel-fuse

Circuit breaker for Laravel queue jobs. Protect your workers from cascading failures.

24773.9k](/packages/harris21-laravel-fuse)[defstudio/telegraph

A laravel facade to interact with Telegram Bots

817336.8k3](/packages/defstudio-telegraph)[nativephp/mobile

NativePHP for Mobile

1.1k102.1k123](/packages/nativephp-mobile)

PHPackages © 2026

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