norman-huth/nova-prism-js

使用 Prism.js 的语法高亮。Laravel Nova 的详细信息字段。

1.1.1 2023-02-21 17:30 UTC

This package is auto-updated.

Last update: 2024-09-21 20:54:05 UTC


README

通过 Prism.js 实现语法高亮的 Nova 详细信息字段。可使用 Markdown 或 HTML。

预览

安装

composer require norman-huth/nova-prism-js

用法

use NormanHuth\NovaPrismJs\PrismJs;

//..
    public function fields(NovaRequest $request): array
    {
        return [
            //..
              PrismJs::make(__('Content'), 'content'),
            //..
        ]
    }

选项

更换主题

设置亮色和暗色模式的 Prism 主题。

  • 主题来自 prismjs.com: default, coy, dark, funky, okaidia, solarizedlight, tomorrow, twilight
  • 主题来自 PrismJS/prism-themes: a11y-dark, atom-dark, base16-ateliersulphurpool-light, cb, coldark-cold, coldark-dark, coy-without-shadows, darcula, dracula, duotone-dark, duotone-earth, duotone-forest, duotone-light, duotone-sea, duotone-space, ghcolors, gruvbox-dark, gruvbox-light, holi-theme, hopscotch, lucario, material-dark, material-light, material-oceanic, night-owl, nord, one-dark, one-light, pojoaque, shades-of-purple, solarized-dark-atom, synthwave84, vs, vsc-dark-plus, xonokai, z-touch
PrismJs::make(__('Content'), 'content')
    ->setTheme('tomorrow')
    ->setDarkTheme('twilight'),

全宽

PrismJs::make(__('Content'), 'content')->fullWidth(),

使用 HTML 而不是 Markdown

PrismJs::make(__('Content'), 'content')->disableMarkdown(),

More Laravel Nova Packages

Stand With Ukraine

Woman. Life. Freedom.