Skip to content

Niremizov/yii2-highlight

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Yii2 highlight.js extension

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'],
                ],
            ]
        ],
        ...
    ],

NOTICE If you overriding asset configuration inside your config file, than you should call for asset register method inside your view like so:

\Yii::$app->getAssetManager()->getBundle('nezhelskoy\highlight\HighlightAsset')->register($this);

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/.

About

Yii2 Highlight.js extension

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • CSS 97.7%
  • PHP 2.3%