mve-it-solutions/yii2-google-code-prettify

使用Google Code Prettify的Yii2代码语法高亮器

安装数: 84,039

依赖者: 0

建议者: 0

安全性: 0

星标: 0

关注者: 1

分支: 0

公开问题: 0

语言:CSS

类型:yii2-extension

0.0.1 2015-11-29 13:47 UTC

This package is not auto-updated.

Last update: 2024-09-14 18:47:36 UTC


README

使用Google Code Prettify的Yii2代码语法高亮器

安装

Composer

安装此扩展的首选方式是通过composer

运行以下命令之一

php composer.phar require --prefer-dist mve-it-solutions/yii2-google-code-prettify "*"

"mve-it-solutions/yii2-google-code-prettify": "*"

将以下内容添加到您的composer.json文件的require部分。

使用方法

要使用此扩展,请将以下内容添加到您的布局中

\mveitsolutions\googlecodeprettify\GoogleCodePrettifyAsset::register($this, ['style' => 'simple', 'lineNums' => true, 'autoAddPreClasses' => true]);
  • 这将使用simple.css中定义的样式
  • 这将给pre(代码)块中的每一行添加行号
  • 这将自动给每个pre标签添加prettyprint和linenums类

AssetBundle注册选项

style Google Code Prettify皮肤 选项:desert, doxy, prettify, sons-of-obsidian, sunburst或simple

lineNums 在每一行上放置行号 选项:true或false

autoAddPreClasses 自动给每个pre标签添加类 选项:true或false

许可证

yii2-google-code-prettify遵循MIT许可证发布。有关详细信息,请参阅LICENSE.md文件。