PHPackages                             jacksleight/bard-mutator - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. jacksleight/bard-mutator

Abandoned → [jacksleight/statamic-bard-mutator](/?search=jacksleight%2Fstatamic-bard-mutator)Library[Utility &amp; Helpers](/categories/utility)

jacksleight/bard-mutator
========================

0.1.4(4y ago)26293[1 PRs](https://github.com/jacksleight/bard-mutator/pulls)PHP

Since Sep 23Pushed 10mo ago1 watchersCompare

[ Source](https://github.com/jacksleight/bard-mutator)[ Packagist](https://packagist.org/packages/jacksleight/bard-mutator)[ RSS](/packages/jacksleight-bard-mutator/feed)WikiDiscussions main Synced 3w ago

READMEChangelog (10)Dependencies (1)Versions (6)Used By (0)

Bard Mutator
============

[](#bard-mutator)

This Statamic addon allows you to modify the data and tags rendered by the Bard fieldtype, giving you full control over the final HTML. You can add, remove and modify attributes, wrap tags and content, or rename and replace tags entirely. You can also make changes the raw data before anything is rendered to HTML.

Examples
--------

[](#examples)

Here are a few examples of what's possible. For more information and more examples check [the documentation](https://jacksleight.dev/docs/bard-mutator/examples).

### Add a class to all external links

[](#add-a-class-to-all-external-links)

```
use JackSleight\StatamicBardMutator\Facades\Mutator;
use Statamic\Facades\URL;

Mutator::html('link', function ($value) {
    if (URL::isExternal($value[1]['href'])) {
        $value[1]['class'] = 'external';
    }
    return $value;
});
```

### Add an auto-generated ID to all level 2 headings

[](#add-an-auto-generated-id-to-all-level-2-headings)

```
use Illuminate\Support\Str;
use JackSleight\StatamicBardMutator\Facades\Mutator;

Mutator::html('heading', function ($value, $item) {
    if ($item->attrs->level === 2) {
        $value[1]['id'] = Str::slug(collect($item->content)->implode('text', ''));
    }
    return $value;
});
```

### Add permalink anchors to all headings

[](#add-permalink-anchors-to-all-headings)

```
use Illuminate\Support\Str;
use JackSleight\StatamicBardMutator\Facades\Mutator;
use JackSleight\StatamicBardMutator\Support\Data;

Mutator::data('heading', function ($data) {
    $slug = Str::slug(collect($data->content)->implode('text', ''));
    array_unshift(
        $data->content,
        Data::html('#')
    );
});
```

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

[](#documentation)

[Statamic Bard Mutator Documentation](https://jacksleight.dev/docs/bard-mutator)

Compatibility
-------------

[](#compatibility)

In order to give you access to the Tiptap rendering process Bard Mutator has to override the Tiptap editor class and replace the built-in extensions with its own. It can only do that reliably if there are no other addons (or user code) trying to do the same thing. To help minimise incompatibilities Bard Mutator will only replace extensions that are actually being mutated, and this is only required for HTML plugins.

Sponsoring
----------

[](#sponsoring)

This addon is completely free to use. However fixing bugs, adding features and helping users takes time and effort. If you find this addon useful and would like to support its development any [contribution](https://github.com/sponsors/jacksleight) would be greatly appreciated. Thanks! 🙂

###  Health Score

30

—

LowBetter than 62% of packages

Maintenance39

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity44

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 98.4% 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 ~1 days

Total

5

Last Release

1729d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/126740?v=4)[Jack Sleight](/maintainers/jacksleight)[@jacksleight](https://github.com/jacksleight)

---

Top Contributors

[![jacksleight](https://avatars.githubusercontent.com/u/126740?v=4)](https://github.com/jacksleight "jacksleight (185 commits)")[![jelleroorda](https://avatars.githubusercontent.com/u/9193686?v=4)](https://github.com/jelleroorda "jelleroorda (1 commits)")[![robdekort](https://avatars.githubusercontent.com/u/69107412?v=4)](https://github.com/robdekort "robdekort (1 commits)")[![wesort](https://avatars.githubusercontent.com/u/3920126?v=4)](https://github.com/wesort "wesort (1 commits)")

### Embed Badge

![Health badge](/badges/jacksleight-bard-mutator/health.svg)

```
[![Health](https://phpackages.com/badges/jacksleight-bard-mutator/health.svg)](https://phpackages.com/packages/jacksleight-bard-mutator)
```

###  Alternatives

[statamic/seo-pro

68488.6k](/packages/statamic-seo-pro)[statamic-rad-pack/runway

Eloquently manage your database models in Statamic.

135212.4k7](/packages/statamic-rad-pack-runway)[statamic/ssg

Generate static sites with Statamic.

254319.5k](/packages/statamic-ssg)[rias/statamic-redirect

29322.9k](/packages/rias-statamic-redirect)[spatie/statamic-responsive-images

Responsive Images for Statamic

114250.6k](/packages/spatie-statamic-responsive-images)[marcorieser/statamic-livewire

A Laravel Livewire integration for Statamic.

23100.9k12](/packages/marcorieser-statamic-livewire)

PHPackages © 2026

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