yii2-highlight
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist xinyeweb/yii2-highlight "*"
or add
"xinyeweb/yii2-highlight": "*"
to the require section of your composer.json
file.
Once the extension is installed, simply use it in your code by :
xinyeweb\highlight\HighlightAsset::register($this);
You can override style in your config file, e.g. config/web.php
:
'components' => [
...
'assetManager' => [
'bundles' => [
'xinyeweb\highlight\HighlightAsset' => [
'css' => ['styles/zenburn.css'],
],
]
],
...
],
Example of custom cofiguraton of selector
or options
properties
'components' => [
...
'assetManager' => [
'bundles' => [
'xinyeweb\highlight\HighlightAsset' => [
'selector' => '.is-highlighted',
'options' => [
'classPrefix' => 'custom-',
'useBR' => true,
],
'css' => ['styles/zenburn.css'],
],
]
],
...
],
Using of custom build, located in /js/highlight
, for example
'components' => [
...
'assetManager' => [
'bundles' => [
'xinyeweb\highlight\HighlightAsset' => [
'sourcePath' => null,
'css' => ['/js/highlight/styles/zenburn.css'],
'js' => ['/js/highlight/highlight.pack.js'],
],
]
],
...
],