Skip to content

Add a Filament infolist entry for themeable syntax highlighting using highlight.js

License

Notifications You must be signed in to change notification settings

parallax/filament-syntax-entry

Folders and files

NameName
Last commit message
Last commit date

Latest commit

2f7ec5e · Feb 2, 2024

History

10 Commits
Feb 1, 2024
Feb 2, 2024
Feb 1, 2024
Feb 2, 2024
Feb 2, 2024
Jan 31, 2024
Jan 31, 2024
Jan 31, 2024
Jan 31, 2024
Feb 2, 2024
Feb 1, 2024
Feb 2, 2024
Feb 2, 2024
Feb 1, 2024
Feb 1, 2024
Feb 1, 2024
Jan 31, 2024
Feb 1, 2024
Feb 1, 2024
Feb 1, 2024

Repository files navigation

Filament Syntax Entry

Latest Version on Packagist Software License Total Downloads Stars

Add a Filament infolist entry for themeable syntax highlighting using highlight.js.

Installation

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"

Quickstart

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'),
            ]);
    }
}

Setting the language

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

Setting the theme

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

Changelog

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

Credits

License

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