Skip to content Skip to sidebar Skip to footer

Ckeditor Code Snippet Plugin Does Not Do Syntax Highlighting In Yii2 Framework

I am using CKEditor and its Code Snippet plugin in yii2 php framework application. I would like to get syntax highlighting when I write some code using CKEditor, but whatever I do

Solution 1:

I have solved my problem, I had to include hljs.initHighlightingOnLoad(); after highlight.pack.js is loaded on my page. There are few ways to do so, I did it like this:

I have included hljs.initHighlightingOnLoad(); as a part of my site.js script, and I have loaded site.js file after the highlight.pack.js. So I had to update my Asset bundle like this:

public$js = [
    'highlight/highlight.pack.js',
    'js/site.js'
];

I had troubles for few hours and didn't realized that solution is that simple. Must be a brain freeze...

Post a Comment for "Ckeditor Code Snippet Plugin Does Not Do Syntax Highlighting In Yii2 Framework"