torchlight/laravel

此包已被弃用且不再维护。作者建议使用 torchlight/torchlight-laravel 包。

Torchlight的Laravel客户端,语法高亮API。

v0.6.0 2024-05-16 18:16 UTC

README

Tests Latest Stable Version Total Downloads License

一个为Torchlight语法高亮的Laravel框架扩展。

Torchlight是一个与VS Code兼容的语法高亮器,无需JavaScript,支持所有语言,所有VS Code主题,行高亮,git diffing等功能。

安装

要安装,请从Composer中引入此包

composer require torchlight/torchlight-laravel

配置

下载包后,您可以运行以下命令发布您的配置文件

php artisan torchlight:install

运行后,您应该在您的config文件夹中看到一个名为torchlight.php的新文件,内容如下所示

<?php
return [
    // The Torchlight client caches highlighted code blocks. Here
    // you can define which cache driver you'd like to use.
    'cache' => env('TORCHLIGHT_CACHE_DRIVER'),

    // Which theme you want to use. You can find all of the themes at
    // https://torchlight.dev/themes, or you can provide your own.
    'theme' => env('TORCHLIGHT_THEME', 'material-theme-palenight'),

    // Your API token from torchlight.dev.
    'token' => env('TORCHLIGHT_TOKEN'),

    // If you want to register the blade directives, set this to true.
    'blade_components' => true,

    // The Host of the API.
    'host' => env('TORCHLIGHT_HOST', 'https://api.torchlight.dev'),
];

缓存

设置Torchlight将使用的缓存驱动器。

主题

您可以通过调整配置中的theme键来更改所有代码块的主题。

令牌

这是您从torchlight.dev获取的API令牌。(Torchlight对个人和开源项目完全免费。)

Blade组件

默认情况下,Torchlight通过使用自定义Laravel组件来工作。如果您出于任何原因想要禁用组件的注册,可以将此设置为false。

主机

您可以将API请求发送的主机地址更改。不确定您为何想这么做,但您可以做到!