https://github.com/daun/statamic-bard-mutators
A collection of mutators for transforming Statamic Bard content
https://github.com/daun/statamic-bard-mutators
bard plugins statamic
Last synced: 4 months ago
JSON representation
A collection of mutators for transforming Statamic Bard content
- Host: GitHub
- URL: https://github.com/daun/statamic-bard-mutators
- Owner: daun
- License: mit
- Created: 2025-03-13T22:19:47.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2026-02-13T07:39:03.000Z (4 months ago)
- Last Synced: 2026-02-13T14:54:06.055Z (4 months ago)
- Topics: bard, plugins, statamic
- Language: PHP
- Homepage:
- Size: 20.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
Awesome Lists containing this project
README
# đŸ§±  Statamic Bard Mutators
A collection of mutators for transforming [Statamic Bard](https://statamic.dev/fieldtypes/bard) content.
All mutators are implemented as plugins for the [Bard Mutator Addon](https://statamic.com/addons/jacksleight/bard-mutator).
## Installation
Install the package via composer:
```bash
composer require daun/statamic-bard-mutators
```
## Registration
Register any mutators you want to use from the `Mutator` facade. Options can be passed as arguments
to the constructor. You can read more about
[class-based mutator plugins](https://jacksleight.dev/docs/bard-mutator/plugins#class-based-plugins)
in the addon readme.
```php
use JackSleight\StatamicBardMutator\Facades\Mutator;
use Daun\BardMutators\MarkExternalLinks;
Mutator::plugin(new MarkExternalLinks());
```
## Mutators
### Mark External Links
Mark external links with `target="_blank"` and `rel="external"`.
```html
External link
```
```php
new MarkExternalLinks();
// Optionally customize the `target` and `rel` attributes
new MarkExternalLinks(
target: '_blank',
rel: 'noopener noreferrer'
);
```
### Mark Asset Links
Mark links to assets with `download="filename.ext"`.
```html
Download video
```
```php
new MarkAssetLinks();
```
### Generate Heading IDs
Adds an `id` attribute to headings based on their content.
```html
Heading
Heading
```
```php
new GenerateHeadingIds();
// Customize heading levels to generate IDs for and add a prefix to generated IDs
new GenerateHeadingIds(
levels: [2, 3],
prefix: 'section-'
);
```
### Semantic Blockquotes
Wraps blockquotes in a `figure` element and moves the author/source into a `figcaption` element.
```html
Quote
— Author
Quote
Author
```
```php
new SemanticBlockquotes();
// Optionally add a class to the figure element
new SemanticBlockquotes(
class: 'quote'
);
```
## Wrap Tables
Wraps tables in a `div` element to allow for horizontal scrolling on smaller screens.
```html
...
...
```
```php
new WrapTables();
// Optionally use a custom tag or add a class to the wrapper element
new WrapTables(
tag: 'section',
class: 'table'
);
```
## Remove List Item Paragraphs
Remove the paragraphs that tiptap automatically adds inside list items.
```html
List item
List item
```
```php
new RemoveListItemParagraphs();
```
## License
[MIT](https://opensource.org/licenses/MIT)