1. Go to this page and download the library: Download daun/statamic-bard-mutators library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
daun / statamic-bard-mutators example snippets
use JackSleight\StatamicBardMutator\Facades\Mutator;
use Daun\BardMutators\MarkExternalLinks;
Mutator::plugin(new MarkExternalLinks());
new MarkExternalLinks();
// Optionally customize the `target` and `rel` attributes
new MarkExternalLinks(
target: '_blank',
rel: 'noopener noreferrer'
);
new MarkAssetLinks();
// Use original filename as download filename hint
// Requires `daun/statamic-original-filename` package
new MarkAssetLinks(
useOriginalFilename: true
);
new GenerateHeadingIds();
// Customize heading levels to generate IDs for and add a prefix to generated IDs
new GenerateHeadingIds(
levels: [2, 3],
prefix: 'section-'
);
// Register GenerateHeadingIds first so headings get an id to link to.
Mutator::plugin(new GenerateHeadingIds());
Mutator::plugin(new InsertHeadingPermalinks());
// Append the permalink instead of prepending it.
new InsertHeadingPermalinks(behavior: 'append');
// Customize the icon (text, emoji, or raw HTML for an inline SVG).
new InsertHeadingPermalinks(icon: '🔗');
new InsertHeadingPermalinks(icon: '<svg viewBox="0 0 16 16"><path d="…"/></svg>');
// Customize the accessible label. Use `{text}` as a placeholder for the
// resolved heading text.
new InsertHeadingPermalinks(label: 'Jump to {text}');
// Limit which heading levels get a permalink, add a class.
new InsertHeadingPermalinks(
levels: [2, 3],
class: 'heading-permalink',
);
new SemanticBlockquotes();
// Optionally add a class to the figure element
new SemanticBlockquotes(
class: 'quote'
);
new WrapTables();
// Optionally use a custom tag or add a class to the wrapper element
new WrapTables(
tag: 'section',
class: 'table'
);
new NormalizeHeadingLevels();
// Shift every heading down (or up, with negative values). Clamped to h6.
new ShiftHeadingLevels(shift: 1);
// Clamp every heading to be at least h2 (e.g. to keep h1 reserved for the page title).
new ShiftHeadingLevels(min: 2);
// Shift the entire document so its shallowest heading becomes h2,
// preserving relative hierarchy. Mutually exclusive with `shift`.
new ShiftHeadingLevels(start: 2);
// Combine: shift down, then clamp at h2.
new ShiftHeadingLevels(shift: 1, min: 2);
new LazyLoadImages();
// Skip lazy loading on the first image if it sits at the top of the document
// (i.e. is the first node, or appears in the first paragraph or figure).
// Useful for avoiding lazy loading on a likely LCP image.
new LazyLoadImages(
skipFirst: true
);
// Switch to lazysizes.js markup. The image gets a `lazyload` class, its `src`
// is moved to `data-src`, and the native `loading`/`decoding` attributes are
// not added. Pass an optional class name to override `lazyload`.
(new LazyLoadImages())->usingLazysizes();
(new LazyLoadImages())->usingLazysizes('lazy-load');
// Combine with skipFirst: the LCP image is left untouched (no lazyload class,
// no data-src swap) so the browser loads it eagerly.
(new LazyLoadImages(skipFirst: true))->usingLazysizes();
new RemoveListItemParagraphs();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.