Skip to content

An extended markdown editor for Filament

License

Notifications You must be signed in to change notification settings

iniznet/filament-markdown-editor-extended

Repository files navigation

Extended Markdown Editor for Filament

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

Bring alignment tools, spoiler formatting, and a configurable toolbar to Filament’s Markdown editor. This package ships a drop-in field component plus a panel plugin that exposes a single Markdown toolbar definition you can reuse across panels, forms, and repeaters.

Warning

This is an early build. The feature set is still evolving and customization options are limited for now. The package requires Filament Curator (it is included as a dependency), so Curator must be installed and available for the media picker features to work.

Installation

composer require iniznet/filament-markdown-editor-extended

Publish the configuration if you want to customize the global toolbar:

php artisan vendor:publish --tag="filament-markdown-editor-extended-config"

You can also publish the provided stubs:

php artisan vendor:publish --tag="filament-markdown-editor-extended-stubs"

Registering the plugin

Attach the plugin to your panel to share one toolbar definition everywhere. The plugin lives under the Iniznet\FilamentMarkdownEditorExtended namespace.

use Filament\Panel;
use Iniznet\FilamentMarkdownEditorExtended\MarkdownEditorExtendedPlugin;

class AdminPanelProvider extends PanelProvider
{
	public function panel(Panel $panel): Panel
	{
		return $panel->plugins([
			MarkdownEditorExtendedPlugin::make()
				->toolbar([
					['bold', 'italic', 'strike', 'link'],
					['blockquote', 'codeBlock'],
					['spoiler'],
				]),
		]);
	}
}

If you prefer configuration files, edit config/markdown-editor-extended.php instead:

return [
	'toolbar' => [
		['bold', 'italic', 'strike', 'link'],
		['heading'],
		['blockquote', 'codeBlock', 'bulletList', 'orderedList'],
		['alignLeft', 'alignCenter', 'alignRight', 'alignJustify'],
		['spoiler'],
		['table', 'attachFiles'],
		['undo', 'redo'],
	],
];

Using the field

Swap Filament’s MarkdownEditor component for the extended version. Alignment buttons and the spoiler toggle can be enabled/disabled per-field using booleans or closures.

use Iniznet\FilamentMarkdownEditorExtended\Forms\Components\ExtendedMarkdownEditor;

ExtendedMarkdownEditor::make('content')
	->columnSpanFull()
	->alignment(fn (?string $layout) => $layout === 'rich')
	->spoiler()
	->helperText('Spoiler + alignment tools are available when the layout allows rich text.');

If you remove buttons from the toolbar, the component automatically strips unavailable actions while keeping the rest intact.

Testing & code style

# run the test suite
composer test

# fix formatting
composer format

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.

About

An extended markdown editor for Filament

Topics

Resources

License

Contributing

Security policy

Stars

Watchers

Forks

Sponsor this project

Packages

No packages published

Contributors 3

  •  
  •  
  •