Syntax highlighter that works server-side.

0 stars out of 5

0 0 0 0 0
  • Author Taufik Nurrohman
  • Link External URL
  • Maintainer 1
  • Member
  • Version 3.0.0
Table of Contents
  1. Usage
  2. Usage in Markdown
  3. Syntax Highlighter Theme

Highlight.php is a server-side syntax highlighter written in PHP. It’s a port of highlight.js by Ivan Sagalaev that makes full use of the language and style definitions of the original JavaScript project.


Add one of the language type available in .\lot\x\highlight\engine\i\@scrivo\highlight.php\Highlight\languages folder to the <code> element:

<pre><code class="php">&lt;?php

function foo($bar) {
    return 'baz';

Add lang- or language- prefix to the language type to make it a priority if you have multiple classes added to the <code> element:

<pre><code class="foo bar language-php baz">&lt;?php

function foo($bar) {
    return 'baz';

Without specifying a priority, this extension will try to use one of the most relevant language types between foo, bar and baz:

<pre><code class="foo bar baz">&lt;?php

function foo($bar) {
    return 'baz';

Usage in Markdown

Use fenced code block syntax to add the language type to the <code> element in Markdown:

~~~ .php

function foo($bar) {
    return 'baz';

Syntax Highlighter Theme

Set your preferred syntax highlighter theme to the skin property in .\lot\x\highlight\state.php file:

return [
    'skin' => 'agate'

Or use the global state modifier to overwrite it in .\lot\y\*\index.php file:

State::set('x.highlight.skin', 'agate');


No comments yet.