定制 aozen/prism2torchlight 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

aozen/prism2torchlight

最新稳定版本:v1.0.0

Composer 安装命令:

composer require aozen/prism2torchlight

包简介

Laravel package to seamlessly convert PrismJS HTML code blocks to Torchlight syntax highlighting.

README 文档

README

Prism2Torchlight is a Laravel package designed to effortlessly convert PrismJS HTML code blocks to Torchlight syntax highlighting.

Installation

You can install the package via Composer:

composer require aozen/prism2torchlight

Usage

To use Prism2Torchlight, you need to include the TorchlightCast class in your Eloquent model's $casts property. This will automatically convert PrismJS code blocks when retrieving data from the database.

use Aozen\Prism2Torchlight\TorchlightCast;

class YourModel extends Model
{
    protected $casts = [
        'text' => TorchlightCast::class,
    ];
}

Example

$text = '<pre class="language-php"><code>echo "Hello, Laravel!";</code></pre>';
$convertedText = Prism2Torchlight\Prism2Torchlight::convertToTorchlight($text);

echo $convertedText;

Requirements

  1. PHP >= 7.3
  2. Laravel >= 7.0

License

This package is open-source software licensed under the MIT license. Feel free to copy and paste this content into your README.md file. Let me know if you have any further requests or modifications!

统计信息

  • 总下载量: 7
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-12-03