- api
- since 7.5.0.0
| Constants |
public Highlight
|
| Methods |
public __construct( $loadAllLanguages = true)
|
| public static clearAllLanguages() Clear all registered languages.
|
public disableSafeMode()
|
public enableSafeMode()
|
| public getAliasesForLanguage( $name) Returns list of all available aliases for given language name.
|
| public getClassPrefix() Get the class prefix string.
|
| public getTabReplace() Get the tab replacement string.
|
| public highlight( $languageName, $code, $ignoreIllegals = true, $continuation = NULL) 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:
|
| public highlightAuto( $code, $languageSubset = NULL) Highlight the given code by highlighting the given code with each registered language and then finding the match with highest accuracy.
|
| public static listBundledLanguages() Return a list of all available languages bundled with this library.
|
| public static listRegisteredLanguages( $includeAliases = false) Return a list of all the registered languages. Using this list in setAutodetectLanguages will turn on auto-detection for all supported languages.
|
| public static registerAllLanguages() Register all 185+ languages that are bundled in this library. To register languages individually, use
|
| public static registerLanguage( $languageId, $filePath, $overwrite = false) Register a language definition with the Highlighter's internal language storage. Languages are stored in a static variable, so they'll be available across all instances. You only need to register a language once.
|
| public setAutodetectLanguages(array $set) Set the languages that will used for auto-detection. When using auto- detection the code to highlight will be probed for every language in this set. Limiting this set to only the languages you want to use will greatly improve highlighting speed.
|
| public setClassPrefix( $classPrefix) Set the class prefix string.
|
| public setTabReplace( $tabReplace) Set the tab replacement string. This defaults to NULL: no tabs will be replaced.
|
| Properties |
private static $aliases = ['php' => 'php', 'php3' => 'php', 'php4' => 'php', 'php5' => 'php', 'php6' => 'php', 'php7' => 'php']
|
private static $bundledLanguages = []
|
private static $classMap = ['php' => Highlight
|
private $codeToHighlight = NULL
|
private $continuations = []
|
private $ignoreIllegals = false
|
private $language = NULL
|
private static $languages = ['php']
|
private $lastMatch = NULL
|
private $modeBuffer = ''
|
private $options = NULL
|
private $relevance = 0
|
private $result = ''
|
private $safeMode = true
|
private $top = NULL
|
| Methods |
| private autoDetection( $name) Determine whether or not a language definition supports auto detection.
|
private buildSpan( $className, $insideSpan, $leaveOpen = false, $noPrefix = false)
|
private doBeginMatch( $match)
|
private doEndMatch( $match)
|
private endOfMode( $mode, $lexeme)
|
private escape( $value)
|
private escapeRe( $value)
|
private getLanguage( $name)
|
private keywordMatch( $mode, $match)
|
private processBuffer()
|
private processKeywords()
|
private processLexeme( $textBeforeMatch, $match = NULL)
|
private processSubLanguage()
|
| private replaceTabs( $code) Replace tabs for something more usable.
|
private startNewMode( $mode)
|
private testRe( $re, $lexeme)
|
| Properties |
private static $aliases = ['php' => 'php', 'php3' => 'php', 'php4' => 'php', 'php5' => 'php', 'php6' => 'php', 'php7' => 'php']
|
private static $bundledLanguages = []
|
private static $classMap = ['php' => Highlight
|
private static $languages = ['php']
|
| Methods |
| public static clearAllLanguages() Clear all registered languages.
|
| public static listBundledLanguages() Return a list of all available languages bundled with this library.
|
| public static listRegisteredLanguages( $includeAliases = false) Return a list of all the registered languages. Using this list in setAutodetectLanguages will turn on auto-detection for all supported languages.
|
| public static registerAllLanguages() Register all 185+ languages that are bundled in this library. To register languages individually, use
|
| public static registerLanguage( $languageId, $filePath, $overwrite = false) Register a language definition with the Highlighter's internal language storage. Languages are stored in a static variable, so they'll be available across all instances. You only need to register a language once.
|