Add a Filament infolist entry for themeable syntax highlighting using highlight.js.
Install the package via composer:
composer require parallax/filament-syntax-entryOptionally, you can publish the views using
php artisan vendor:publish --tag="filament-syntax-entry-views"Add the Infolist entry
Add the SyntaxEntry to the $infolist->schema() method.
<?php
namespace App\Filament\Resources;
use Parallax\FilamentSyntaxEntry\SyntaxEntry;
class ProductResource extends Resource
{
public static function infolist(Infolist $infolist): Infolist
{
return $infolist
->schema([
SyntaxEntry::make('metadata'),
]);
}
}Automatic language detection is enabled by default so this isn't required, but if you would like to define the language used you may use the language() method:
SyntaxEntry::make('metadata')
->language('json');To keep the bundle size down only the following languages are currently available:
bashcssdockerfilegraphqljavascriptjsonmarkdownphpscssshellsqltypescriptxmlyaml
You may override the default themes using the theme() and/or darkModeTheme() methods:
SyntaxEntry::make('metadata')
->theme('filament')
->darkModeTheme('filament-dark');The following themes are currently available:
a11y-darka11y-lightagatean-old-hopeandroidstudioarduino-lightartaasceticatom-one-dark-reasonableatom-one-darkatom-one-lightbrown-papercodepen-embedcolor-brewerdarkdefaultdevibeansdoccofarfelipecfilament-dark(default dark mode theme)filament(default theme)foundationgithub-dark-dimmedgithub-darkgithubgmlgooglecodegradient-darkgradient-lightgrayscalehybridideaintellij-lightir-blackisbl-editor-darkisbl-editor-lightkimbie-darkkimbie-lightlightfairlioshimagulamono-bluemonokai-sublimemonokainight-owlnnfx-darknnfx-lightnordobsidianpanda-syntax-darkpanda-syntax-lightparaiso-darkparaiso-lightpojoaquepurebasicqtcreator-darkqtcreator-lightrainbowrouterosschool-bookshades-of-purplesrcerystackoverflow-darkstackoverflow-lightsunbursttokyo-night-darktokyo-night-lighttomorrow-night-bluetomorrow-night-brightvsvs2015xcodext256
Please see CHANGELOG for more information on what has changed recently.
The MIT License (MIT). Please see License File for more information.
