PHPackages                             wnx/commonmark-mark-extension - 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. wnx/commonmark-mark-extension

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

wnx/commonmark-mark-extension
=============================

Render ==highlighted== texts as &lt;mark&gt; elements in league/commonmark

v1.4.0(3mo ago)1313.8kMITPHPPHP ^8.0CI passing

Since Aug 25Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/stefanzweifel/commonmark-mark-extension)[ Packagist](https://packagist.org/packages/wnx/commonmark-mark-extension)[ Docs](https://github.com/wnx/commonmark-mark-extension)[ Fund](https://buymeacoff.ee/3oQ64YW)[ GitHub Sponsors](https://github.com/stefanzweifel)[ RSS](/packages/wnx-commonmark-mark-extension/feed)WikiDiscussions main Synced today

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

Parse and Render ==marked text== with league/commonmark
=======================================================

[](#parse-and-render-marked-text-with-leaguecommonmark)

[![Latest Version on Packagist](https://camo.githubusercontent.com/82a98773b0f2ead1ec193cb5bf98248eef4213364b0ae9720b9993a9608d36ff/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f776e782f636f6d6d6f6e6d61726b2d6d61726b2d657874656e73696f6e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/wnx/commonmark-mark-extension)[![Tests](https://github.com/stefanzweifel/commonmark-mark-extension/actions/workflows/run-tests.yml/badge.svg)](https://github.com/stefanzweifel/commonmark-mark-extension/actions/workflows/run-tests.yml)[![Check & fix styling](https://github.com/stefanzweifel/commonmark-mark-extension/actions/workflows/php-cs-fixer.yml/badge.svg)](https://github.com/stefanzweifel/commonmark-mark-extension/actions/workflows/php-cs-fixer.yml)[![Total Downloads](https://camo.githubusercontent.com/1f2eb5bfd0a6f5cc486f1c96137e8d2268184229e1e39ab506b5df5f8a4c631f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f776e782f636f6d6d6f6e6d61726b2d6d61726b2d657874656e73696f6e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/wnx/commonmark-mark-extension)

A [league/commonmark](https://github.com/thephpleague/commonmark) extension to turn highlighted text into [``-HTML](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/mark) elements.

For example, the following markdown text …

```
The ==quick brown fox== jumps over the lazy dog.
```

… is turned into the following HTML.

```
The quick brown fox jumps over the lazy dog.
```

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

[](#installation)

You can install the package via composer:

```
composer require wnx/commonmark-mark-extension
```

Usage
-----

[](#usage)

Create a custom CommonMark environment, and register the `MarkExtension`.

```
use League\CommonMark\Environment\Environment;
use League\CommonMark\Extension\CommonMark\CommonMarkCoreExtension;
use League\CommonMark\MarkdownConverter;
use Wnx\CommonmarkMarkExtension\MarkExtension;

// Configure the Environment with all the CommonMark parsers/renderers
$environment = new Environment();
$environment->addExtension(new CommonMarkCoreExtension());

// Add this extension
$environment->addExtension(new MarkExtension());

// Instantiate the converter engine and start converting some Markdown!
$converter = new MarkdownConverter($environment);
echo $converter->convertToHtml('The ==quick== brown fox jumps over the ==lazy dog==');
```

If you're using a different character than `=` to highlight text in Markdown, you can pass a `character` configuration to the extension.

```
use League\CommonMark\Environment\Environment;
use League\CommonMark\Extension\CommonMark\CommonMarkCoreExtension;
use League\CommonMark\MarkdownConverter;
use Wnx\CommonmarkMarkExtension\MarkExtension;

// Define your configuration, if needed
$config = [
    'mark' => [
        'character' => ':',
    ],
];

// Configure the Environment with all the CommonMark parsers/renderers
$environment = new Environment($config);
$environment->addExtension(new CommonMarkCoreExtension());

// Add this extension
$environment->addExtension(new MarkExtension());

// Instantiate the converter engine and start converting some Markdown!
$converter = new MarkdownConverter($environment);
echo $converter->convertToHtml('The ::quick:: brown fox jumps over the ::lazy dog::');
```

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)

- [Stefan Zweifel](https://github.com/stefanzweifel)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

48

—

FairBetter than 95% of packages

Maintenance78

Regular maintenance activity

Popularity32

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~387 days

Total

5

Last Release

118d ago

### Community

Maintainers

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

---

Top Contributors

[![stefanzweifel](https://avatars.githubusercontent.com/u/1080923?v=4)](https://github.com/stefanzweifel "stefanzweifel (26 commits)")

---

Tags

commonmarkcommonmark-extensionmarkdownwnxcommonmark-mark-extension

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/wnx-commonmark-mark-extension/health.svg)

```
[![Health](https://phpackages.com/badges/wnx-commonmark-mark-extension/health.svg)](https://phpackages.com/packages/wnx-commonmark-mark-extension)
```

###  Alternatives

[spatie/laravel-markdown

A highly configurable markdown renderer and Blade component for Laravel

4043.2M27](/packages/spatie-laravel-markdown)[daux/daux.io

Documentation generator that uses a simple folder structure and Markdown files to create custom documentation on the fly

826188.8k1](/packages/daux-dauxio)[spatie/sheets

Store &amp; retrieve your static content in plain text files

30185.5k3](/packages/spatie-sheets)[prezet/prezet

Prezet: Markdown Blogging for Laravel

2968.1k2](/packages/prezet-prezet)[sinnbeck/markdom

Converts markdown to html with classes

69117.2k1](/packages/sinnbeck-markdom)[bookdown/bookdown

Provides DocBook-like rendering of Markdown files.

8256.9k13](/packages/bookdown-bookdown)

PHPackages © 2026

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