Adds a simple form field that renders a read-only Highlight.js code block for FilamentPHP. The plugin is new and may be unstable and contain bugs. PRs and issue reports are welcome.
You can install the package via composer:
composer require desilva/filament-simple-highlight-field
This package supports Laravel 9 and Laravel 10.
Simply use the component as you'd use any other Filament field. It's especially perfect for the resource view page where it blends right in.
use Desilva\FilamentSimpleHighlightField\HighlightField;
class FileResource extends Resource
{
public static function form(Form $form): Form
{
return $form
->schema([
HighlightField::make('contents')
->columnSpan('full'),
]);
}
}
- Add option to customize the theme
- Dark mode support (doesn't work with custom theme)
- Add method chain to specify the language
You can publish the config file with:
php artisan vendor:publish --tag="filament-simple-highlight-field-config"
This is the contents of the published config file:
return [
// By default, the plugin will load serve the assets from Filament. You can uncomment the following to specify
// a custom theme that will then be loaded from the Highlight.js CDN. See https://highlightjs.org/static/demo
// 'theme' => 'nord',
];
Optionally, you can publish the views using
php artisan vendor:publish --tag="filament-simple-highlight-field-views"
Please see CHANGELOG for more information on what has changed recently.
Contributing is pretty chill and is highly appreciated! Just send a PR and/or create an issue!
Please review my General Security Policy on how to report security vulnerabilities.
The MIT License (MIT). Please see License File for more information.