Class Highlight\Highlighter

InheritanceHighlight\Highlighter

Public Methods

Hide inherited methods

MethodDescriptionDefined By
__construct() Highlight\Highlighter
getTabReplace() Get the tab replacement string. Highlight\Highlighter
highlight() 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) Highlight\Highlighter
highlightAuto() Highlight\Highlighter
listLanguages() Return a list of all supported languages. Using this list in setAutodetectLanguages will turn on autodetection for all supported languages. Highlight\Highlighter
setAutodetectLanguages() Set the set of languages used for autodetection. When using autodetection 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. Highlight\Highlighter
setTabReplace() Set the tab replacement string. This defaults to NULL: no tabs will be replaced. Highlight\Highlighter

Method Details

__construct() public method

public void __construct ( )
getTabReplace() public method

Get the tab replacement string.

public string getTabReplace ( )
return string

The tab replacement string.

highlight() public method

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)

public void highlight ( $language, $code, $ignoreIllegals true, $continuation null )
$language
$code
$ignoreIllegals
$continuation
throws \Highlight\A

DomainException if the requested language was not in this

 Highlighter's language set.
highlightAuto() public method

public void highlightAuto ( $code, $languageSubset null )
$code
$languageSubset
listLanguages() public method

Return a list of all supported languages. Using this list in setAutodetectLanguages will turn on autodetection for all supported languages.

public array listLanguages ( )
return array

An array of language names (strings).

setAutodetectLanguages() public method

Set the set of languages used for autodetection. When using autodetection 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 void setAutodetectLanguages ( array $set )
$set array

An array of language games to use for autodetection. This defaults

 to a typical set Web development languages.
setTabReplace() public method

Set the tab replacement string. This defaults to NULL: no tabs will be replaced.

public void setTabReplace ( $tabReplace )
$tabReplace string

The tab replacement string.