assertchris / laravel-highlight-web-component
一个使用 tempest/highlight 开发的自定义 Web Component 来高亮代码的 Laravel 插件。
1.0.1
2024-05-04 09:39 UTC
Requires
- php: ^8.3
- illuminate/cache: ^9.0|^10.0|^11.0
- illuminate/http: ^9.0|^10.0|^11.0
- illuminate/support: ^9.0|^10.0|^11.0
- tempest/highlight: ^2.3
Requires (Dev)
- orchestra/testbench: ^9.0
README
这是一个 Laravel 插件,它引入了一个自定义的 Web Component,用于使用 tempest/highlight 高亮代码。
开始使用
composer require assertchris/laravel-highlight-web-component
导入并使用自定义组件
import Component from '../../vendor/assertchris/laravel-highlight-web-component/src/component.js'; customElements.define('w-code', Component);
在模板中使用它
<w-code lang="php"> print "hello world"; </w-code>
警告
您仍然需要在 Laravel 项目中包含 Axios 才能使此功能正常工作。
配置
您可以通过发布供应商配置文件来查看和自定义配置
php artisan vendor:publish --provider=AC\\LaravelHighlightWebComponent\\Provider