xutl/yii2-highlightjs-widget

The highlightjs extension for the Yii framework

Installs: 216

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

Language:JavaScript

Type:yii2-extension

2.0.1 2017-06-06 01:48 UTC

This package is auto-updated.

Last update: 2024-04-11 01:51:55 UTC


README

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist xutl/yii2-highlightjs-asset

or add

"xutl/yii2-highlightjs-asset": "~1.0.0"

to the require section of your composer.json file.

Usage

use xutl\highlightjs\HighlightJsAsset;
HighlightJsAsset::register($this,'php');
$this->registerJs('hljs.initHighlightingOnLoad();');
use xutl\highlightjs\HighlightJs;

HighlightJs::begin([
    'format'=>$model->format
]);
echo Html::encode($model->content); ?>
HighlightJs::end()