Mecha CMS

Add extra functionality to the core engine.


Table of Contents
  1. Usage 
  2. Usage in Markdown 
  3. Syntax Highlighter Theme 

Syntax highlighter that works server-side.

Download Stable Version Download Development Version

Something looks broken? We accept bounties to fix them faster.

v2.0.2193 Downloads
v2.0.192 Downloads
v2.0.0101 Downloads

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', // ← this
    'state' => [ … ]

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

State::set('', 'agate');