Filament Carve
#Filament Carve
Carve markup for Filament, built on jeffersongoncalves/laravel-carve:
CarveEditor: a textarea that validates Carve source and previews the rendered HTML in a modal.CarveEntry: an infolist entry that renders Carve source as HTML.CarveColumn: a table column that shows Carve source as plain text, or as HTML.
#Compatibility
#Installation
You can install the package via composer:
composer require jeffersongoncalves/filament-carve
Rendering is configured by laravel-carve. Publish its config to change the render profiles (default, comment, trusted, ...):
php artisan vendor:publish --tag="carve-config"
#Usage
#Editor
use JeffersonGoncalves\Filament\Carve\Forms\Components\CarveEditor; CarveEditor::make('body') ->profile('comment') // laravel-carve profile used by the preview ->preset('comment') // fail validation on markup the preset does not allow ->strict() // fail validation on parse warnings ->lint() // fail validation on lint findings, such as Markdown's **bold** ->previewable(false); // hide the preview action
CarveEditor extends Filament's Textarea, so every textarea method (rows(), autosize(), maxLength(), ...) still works. The source is always checked with laravel-carve's ValidCarve rule.
#Infolist entry
use JeffersonGoncalves\Filament\Carve\Infolists\Components\CarveEntry; CarveEntry::make('body') ->profile('trusted');
#Table column
use JeffersonGoncalves\Filament\Carve\Tables\Columns\CarveColumn; CarveColumn::make('body')->limit(80); // plain text excerpt CarveColumn::make('body')->html(); // rendered HTML
#Security
Rendered HTML is printed unescaped. Safety comes from the laravel-carve profile: use a safe_mode profile (the default and comment profiles are safe) for user supplied content, and a profile with safe_mode => false only for content you trust.
#Testing
composer test
#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.