Add a Filament infolist entry for themeable syntax highlighting using highlight.js.
Install the package via composer:
composer require parallax/filament-syntax-entry
Optionally, you can publish the views using
php artisan vendor:publish --tag="filament-syntax-entry-views"
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 budle size down only the following languages are currently available:
bash
css
dockerfile
graphql
javascript
json
markdown
php
scss
shell
sql
typescript
xml
yaml
You may override the default themes using the theme()
and/or darkModeTheme()
methods:
SyntaxEntry::make('metadata')
->theme('filament')
->darkModeTheme('filament-dark');
To keep the budle size down only the following languages are currently available:
a11y-dark
a11y-light
agate
an-old-hope
androidstudio
arduino-light
arta
ascetic
atom-one-dark-reasonable
atom-one-dark
atom-one-light
brown-paper
codepen-embed
color-brewer
dark
default
devibeans
docco
far
felipec
filament-dark
(default dark mode theme)filament
(default theme)foundation
github-dark-dimmed
github-dark
github
gml
googlecode
gradient-dark
gradient-light
grayscale
hybrid
idea
intellij-light
ir-black
isbl-editor-dark
isbl-editor-light
kimbie-dark
kimbie-light
lightfair
lioshi
magula
mono-blue
monokai-sublime
monokai
night-owl
nnfx-dark
nnfx-light
nord
obsidian
panda-syntax-dark
panda-syntax-light
paraiso-dark
paraiso-light
pojoaque
purebasic
qtcreator-dark
qtcreator-light
rainbow
routeros
school-book
shades-of-purple
srcery
stackoverflow-dark
stackoverflow-light
sunburst
tokyo-night-dark
tokyo-night-light
tomorrow-night-blue
tomorrow-night-bright
vs
vs2015
xcode
xt256
Please see CHANGELOG for more information on what has changed recently.
The MIT License (MIT). Please see License File for more information.