Smart.Framework Logo

class \SmartModExtLib\HighlightSyntax\Highlighter
{ } ->

Class: \SmartModExtLib\HighlightSyntax\Highlighter
HighLight Code Syntax using PHP only, compatible with Highlight.Js
</pre>';
</code>


class Methods

public function __construct ( BOOLEAN $register_all_languages = true ) {} @ 
@param: {BOOLEAN} $register_all_languages: *Optional* ; Default is TRUE ; If set to false the class will not pre-load all available languages and aliases will not be available so in this case exact language match must be indicated
Class Constructor
public function highlight ( STRING $language, STRING $code, BOOLEAN $ignoreIllegals = true, NULL $continuation = null ) {} -> OBJECT
@return: {OBJECT}
@param: {STRING} $language: The code syntax type or an alias ; Ex: javascript
@param: {STRING} $code: The code to be highlighted
@param: {BOOLEAN} $ignoreIllegals: Setting to ignore or not illegal syntax ; Default is TRUE
@param: {NULL} $continuation: This must be not used ; it is set automated to NULL when initiated and rewritten internally as reference
Core highlighting function. Accepts a language name, or an alias, and a
string with the code to highlight. Returns an object with the following properties:
- relevance (int)
- value (an HTML string with highlighting markup).

class Properties


class Constants


Sample code: PHP

<?php

// sample usage:
 
$hl = (new \SmartModExtLib\HighlightSyntax\Highlighter())->highlight('xml'SmartFileSystem::read('a-file.html'));
 echo 
'<pre><code class="hljs '.Smart::escape_html($hl->language).'">'.$hl->value.'

// #end php code


documentation generated on: 2023-10-19 23:15:56 +0000


Smart.Framework © 2009-2023 unix-world.org