torchlight/torchlight-laravel

为Torchlight API提供语法高亮功能的Laravel客户端。

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 diff,更多功能。

安装

要安装,请从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请求发送的主机更改为其他主机。不确定为什么您会想这么做,但是您可以做!