|
static | getLexer ( $lang) |
| Get the Pygments lexer name for a particular language.
|
|
static | plainCodeWrap ( $code, $inline) |
|
|
static array | $mimeLexers |
| Mapping of MIME-types to lexer names.
|
|
Definition at line 21 of file SyntaxHighlight.php.
◆ getLexer()
static SyntaxHighlight::getLexer |
( |
| $lang | ) |
|
|
staticprivate |
◆ getPygmentizePath()
static SyntaxHighlight::getPygmentizePath |
( |
| ) |
|
|
static |
◆ highlight()
static SyntaxHighlight::highlight |
( |
| $code, |
|
|
| $lang = null, |
|
|
| $args = [] ) |
|
static |
Highlight a code-block using a particular lexer.
- Parameters
-
string | $code | Code to highlight. |
string | null | $lang | Language name, or null to use plain markup. |
array | $args | Associative array of additional arguments. If it contains a 'line' key, the output will include line numbers. If it includes a 'highlight' key, the value will be parsed as a comma-separated list of lines and line-ranges to highlight. If it contains a 'start' key, the value will be used as the line at which to start highlighting. If it contains a 'inline' key, the output will not be wrapped in <div><pre/></div> . |
- Returns
- Status Status object, with HTML representing the highlighted code as its value.
Definition at line 226 of file SyntaxHighlight.php.
References $args, $cache, $code, $lang, $lines, $options, $output, function, getLexer(), parseHighlightLines(), plainCodeWrap(), and wfWarn().
Referenced by onApiFormatHighlight(), onContentGetParserOutput(), and parserHook().
◆ onParserFirstCallInit()
static SyntaxHighlight::onParserFirstCallInit |
( |
Parser & | $parser | ) |
|
|
static |
◆ parserHook()
static SyntaxHighlight::parserHook |
( |
| $text, |
|
|
| $args, |
|
|
| $parser ) |
|
static |
◆ plainCodeWrap()
static SyntaxHighlight::plainCodeWrap |
( |
| $code, |
|
|
| $inline ) |
|
staticprivate |
◆ $mimeLexers
array SyntaxHighlight::$mimeLexers |
|
staticprivate |
Initial value:= [
'text/javascript' => 'javascript',
'application/json' => 'javascript',
'text/xml' => 'xml',
]
Mapping of MIME-types to lexer names.
Definition at line 36 of file SyntaxHighlight.php.
The documentation for this class was generated from the following file: