'nodelog', 'version' => 'v1.0', 'id' => 'prettify', 'name' => '代码高亮', 'description' => '代码高亮模块' ]; public function bootstrap($app) { Event::on(View::className(), 'afterComment', [$this, 'run']); Event::on(View::className(), 'afterArticleView', [$this, 'run']); } public function run() { PrettifyAsset::register($this->view); $script = "$('pre').addClass('prettyprint linenums');prettyPrint();"; $this->view->registerJs($script); } }