|
1 |
| -# Add a Filament infolist entry for syntax highlighting. |
| 1 | +# Filament Comments |
2 | 2 |
|
3 |
| -[](https://packagist.org/packages/parallax/filament-syntax-entry) |
4 |
| -[](https://github.com/parallax/filament-syntax-entry/actions?query=workflow%3Arun-tests+branch%3Amain) |
5 |
| -[](https://github.com/parallax/filament-syntax-entry/actions?query=workflow%3A"Fix+PHP+code+style+issues"+branch%3Amain) |
6 |
| -[](https://packagist.org/packages/parallax/filament-syntax-entry) |
| 3 | +[](https://packagist.org/packages/parallax/filament-syntax-entry) |
| 4 | +[](LICENSE.md) |
| 5 | +[](https://packagist.org/packages/parallax/filament-syntax-entry) |
| 6 | + |
7 | 7 |
|
| 8 | +Add a Filament infolist entry for themeable syntax highlighting using [highlight.js](https://highlightjs.org). |
8 | 9 |
|
9 |
| - |
10 |
| -This is where your description should go. Limit it to a paragraph or two. Consider adding a small example. |
| 10 | +<img class="filament-hidden" src="https://github.com/parallax/filament-syntax-entry/raw/main/assets/filament-syntax-entry.jpg"/> |
11 | 11 |
|
12 | 12 | ## Installation
|
13 | 13 |
|
14 |
| -You can install the package via composer: |
| 14 | +Install the package via composer: |
15 | 15 |
|
16 | 16 | ```bash
|
17 | 17 | composer require parallax/filament-syntax-entry
|
18 | 18 | ```
|
19 | 19 |
|
20 |
| -You can publish and run the migrations with: |
21 |
| - |
22 |
| -```bash |
23 |
| -php artisan vendor:publish --tag="filament-syntax-entry-migrations" |
24 |
| -php artisan migrate |
25 |
| -``` |
26 |
| - |
27 |
| -You can publish the config file with: |
28 |
| - |
29 |
| -```bash |
30 |
| -php artisan vendor:publish --tag="filament-syntax-entry-config" |
31 |
| -``` |
32 |
| - |
33 | 20 | Optionally, you can publish the views using
|
34 | 21 |
|
35 | 22 | ```bash
|
36 | 23 | php artisan vendor:publish --tag="filament-syntax-entry-views"
|
37 | 24 | ```
|
38 | 25 |
|
39 |
| -This is the contents of the published config file: |
| 26 | +## Quickstart |
| 27 | + |
| 28 | +### Add the Infolist entry |
| 29 | + |
| 30 | +Add the `SyntaxEntry` to the `$infolist->schema()` method. |
40 | 31 |
|
41 | 32 | ```php
|
42 |
| -return [ |
43 |
| -]; |
| 33 | +<?php |
| 34 | + |
| 35 | +namespace App\Filament\Resources; |
| 36 | + |
| 37 | +use Parallax\FilamentSyntaxEntry\SyntaxEntry; |
| 38 | + |
| 39 | +class ProductResource extends Resource |
| 40 | +{ |
| 41 | + public static function infolist(Infolist $infolist): Infolist |
| 42 | + { |
| 43 | + return $infolist |
| 44 | + ->schema([ |
| 45 | + SyntaxEntry::make('metadata'), |
| 46 | + ]); |
| 47 | + } |
| 48 | +} |
44 | 49 | ```
|
45 | 50 |
|
46 |
| -## Usage |
| 51 | +### Setting the language |
| 52 | + |
| 53 | +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: |
47 | 54 |
|
48 | 55 | ```php
|
49 |
| -$filamentSyntaxEntry = new Parallax\FilamentSyntaxEntry(); |
50 |
| -echo $filamentSyntaxEntry->echoPhrase('Hello, Parallax!'); |
| 56 | +SyntaxEntry::make('metadata') |
| 57 | + ->language('json'); |
51 | 58 | ```
|
52 | 59 |
|
53 |
| -## Testing |
| 60 | +To keep the budle size down only the following languages are currently available: |
54 | 61 |
|
55 |
| -```bash |
56 |
| -composer test |
57 |
| -``` |
| 62 | +- `bash` |
| 63 | +- `css` |
| 64 | +- `dockerfile` |
| 65 | +- `graphql` |
| 66 | +- `javascript` |
| 67 | +- `json` |
| 68 | +- `markdown` |
| 69 | +- `php` |
| 70 | +- `scss` |
| 71 | +- `shell` |
| 72 | +- `sql` |
| 73 | +- `typescript` |
| 74 | +- `xml` |
| 75 | +- `yaml` |
58 | 76 |
|
59 |
| -## Changelog |
| 77 | +### Setting the theme |
60 | 78 |
|
61 |
| -Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently. |
| 79 | +You may override the default themes using the `theme()` and/or `darkModeTheme()` methods: |
62 | 80 |
|
63 |
| -## Contributing |
| 81 | +```php |
| 82 | +SyntaxEntry::make('metadata') |
| 83 | + ->theme('filament') |
| 84 | + ->darkModeTheme('filament-dark'); |
| 85 | +``` |
64 | 86 |
|
65 |
| -Please see [CONTRIBUTING](.github/CONTRIBUTING.md) for details. |
| 87 | +To keep the budle size down only the following languages are currently available: |
| 88 | + |
| 89 | +- `a11y-dark` |
| 90 | +- `a11y-light` |
| 91 | +- `agate` |
| 92 | +- `an-old-hope` |
| 93 | +- `androidstudio` |
| 94 | +- `arduino-light` |
| 95 | +- `arta` |
| 96 | +- `ascetic` |
| 97 | +- `atom-one-dark-reasonable` |
| 98 | +- `atom-one-dark` |
| 99 | +- `atom-one-light` |
| 100 | +- `brown-paper` |
| 101 | +- `codepen-embed` |
| 102 | +- `color-brewer` |
| 103 | +- `dark` |
| 104 | +- `default` |
| 105 | +- `devibeans` |
| 106 | +- `docco` |
| 107 | +- `far` |
| 108 | +- `felipec` |
| 109 | +- `filament-dark` (default dark mode theme) |
| 110 | +- `filament` (default theme) |
| 111 | +- `foundation` |
| 112 | +- `github-dark-dimmed` |
| 113 | +- `github-dark` |
| 114 | +- `github` |
| 115 | +- `gml` |
| 116 | +- `googlecode` |
| 117 | +- `gradient-dark` |
| 118 | +- `gradient-light` |
| 119 | +- `grayscale` |
| 120 | +- `hybrid` |
| 121 | +- `idea` |
| 122 | +- `intellij-light` |
| 123 | +- `ir-black` |
| 124 | +- `isbl-editor-dark` |
| 125 | +- `isbl-editor-light` |
| 126 | +- `kimbie-dark` |
| 127 | +- `kimbie-light` |
| 128 | +- `lightfair` |
| 129 | +- `lioshi` |
| 130 | +- `magula` |
| 131 | +- `mono-blue` |
| 132 | +- `monokai-sublime` |
| 133 | +- `monokai` |
| 134 | +- `night-owl` |
| 135 | +- `nnfx-dark` |
| 136 | +- `nnfx-light` |
| 137 | +- `nord` |
| 138 | +- `obsidian` |
| 139 | +- `panda-syntax-dark` |
| 140 | +- `panda-syntax-light` |
| 141 | +- `paraiso-dark` |
| 142 | +- `paraiso-light` |
| 143 | +- `pojoaque` |
| 144 | +- `purebasic` |
| 145 | +- `qtcreator-dark` |
| 146 | +- `qtcreator-light` |
| 147 | +- `rainbow` |
| 148 | +- `routeros` |
| 149 | +- `school-book` |
| 150 | +- `shades-of-purple` |
| 151 | +- `srcery` |
| 152 | +- `stackoverflow-dark` |
| 153 | +- `stackoverflow-light` |
| 154 | +- `sunburst` |
| 155 | +- `tokyo-night-dark` |
| 156 | +- `tokyo-night-light` |
| 157 | +- `tomorrow-night-blue` |
| 158 | +- `tomorrow-night-bright` |
| 159 | +- `vs` |
| 160 | +- `vs2015` |
| 161 | +- `xcode` |
| 162 | +- `xt256` |
66 | 163 |
|
67 |
| -## Security Vulnerabilities |
| 164 | +## Changelog |
68 | 165 |
|
69 |
| -Please review [our security policy](../../security/policy) on how to report security vulnerabilities. |
| 166 | +Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently. |
70 | 167 |
|
71 | 168 | ## Credits
|
72 | 169 |
|
73 |
| -- [Parallax](https://github.com/parallax) |
74 |
| -- [All Contributors](../../contributors) |
| 170 | +- [Parallax](https://parall.ax) |
| 171 | +- [Contributors](https://github.com/parallax/filament-syntax-entry/graphs/contributors) |
75 | 172 |
|
76 | 173 | ## License
|
77 | 174 |
|
|
0 commit comments