nezhelskoy/yii2-highlight 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

nezhelskoy/yii2-highlight

最新稳定版本:v1.2.8

Composer 安装命令:

composer require nezhelskoy/yii2-highlight

包简介

Yii2 highlight.js extension

README 文档

README

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist nezhelskoy/yii2-highlight "*"

Or add

"nezhelskoy/yii2-highlight": "*"

to the require section of your composer.json file.

Usage

In your view script register asset:

nezhelskoy\highlight\HighlightAsset::register($this);

And manage content, as described in original highlight.js documentation:

<pre><code class="html">...</code></pre>

You can override style in your config file, e.g. config/web.php:

    'components' => [
        ...
        'assetManager' => [
            'bundles' => [
                'nezhelskoy\highlight\HighlightAsset' => [
                    'css' => ['dist/styles/zenburn.css'],
                ],
            ]
        ],
        ...
    ],

Example of custom cofiguraton of selector or options properties

    'components' => [
        ...
        'assetManager' => [
            'bundles' => [
                'nezhelskoy\highlight\HighlightAsset' => [
                    'selector' => '.is-highlighted',
                    'options' => [
                        'classPrefix' => 'custom-',
                        'useBR' => true,
                    ],
                    'css' => ['dist/styles/zenburn.css'],
                ],
            ]
        ],
        ...
    ],

Using of custom build, located in /js/highlight, for example

    'components' => [
        ...
        'assetManager' => [
            'bundles' => [
                'nezhelskoy\highlight\HighlightAsset' => [
                    'sourcePath' => null,
                    'css' => ['/js/highlight/styles/zenburn.css'],
                    'js' => ['/js/highlight/highlight.pack.js'],
                ],
            ]
        ],
        ...
    ],

License

yii2-highlight is released under the BSD License. See LICENSE.md file for details.

Links

The official site for the Highlight.js library is at https://highlightjs.org/.

统计信息

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

GitHub 信息

  • Stars: 14
  • Watchers: 1
  • Forks: 9
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2014-08-31