Code highlighting in multi-user blog woblog

For IT blogs, code highlighting is a very important function, which can make the code in the content clearer and easier to read.

woblog also handles code highlighting. This function is completed through a wordpress plug-in Enlighter, and each user can define their own highlighting style. Currently, Enlighter supports the code types in woblog: Generic Highlighting, Plain text, ABAP, Generic Assembly, Apache httpd, Avr Assembly, C, C++, C#, CSS, Cython, CordPro, Diff, Dockerfile, Groovy, Go, HTML, Ini/Conf Syntax, Java, Javascript, JSON, Kotlin, LaTeX, LESS, lighttpd, LUA , Markdown, Matlab/Octave, NGINX, NSIS, PHP, PowerShell, Prolog, Python, Purebasic, QML, Red, RouterOS, Ruby, Rust, SCALA, SCSS, Shellscript, SQL, Squirrel, Swift, TypeScript, VHDL, VisualBasic, Verilog , XML, YAML, it should be said to be completely enough.

The following is a piece of PHP test code inserted with Enlighter, you can see that the actual use effect is still good.

public function setupFrontend(){
    // load frontend css+js resources - highlighting engine
    $this->_resourceLoader->frontendEnlighter($this->_contentProcessor);
    // check frontend user privileges
    $canEdit = is_user_logged_in() && (current_user_can('edit_posts') || current_user_can('edit_pages'));
    // apply filter
    $canEdit = apply_filters('enlighter_frontend_editing', $canEdit);
    // editor enabled ?
    if ($canEdit === true){
        $this->_resourceLoader->frontendEditor();
    }
}

 

This article is an original article, please indicate the source for reproduced!