Table of Contents
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.
Usage
Add one of the language type available in .\lot\x\highlight\engine\vendor\scrivo\highlight.php\Highlight\languages
folder to the <code>
element:
<pre><code class="php"><?php
function foo($bar) {
return 'baz';
}</code></pre>
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"><?php
function foo($bar) {
return 'baz';
}</code></pre>
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"><?php
function foo($bar) {
return 'baz';
}</code></pre>
Usage in Markdown
Use fenced code block syntax to add the language type to the <code>
element in Markdown:
~~~ .php
<?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' => ['name' => 'agate']
];
Or use the global state modifier to overwrite it in .\lot\y\*\index.php
file:
State::set('x.highlight.skin.name', 'agate');
0 Comments
No comments yet.