MediaWiki REL1_33
|
Static Public Member Functions | |
static | getPygmentizePath () |
static | highlight ( $code, $lang=null, $args=[]) |
Highlight a code-block using a particular lexer. | |
static | onParserFirstCallInit (Parser &$parser) |
Register parser hook. | |
static | parserHook ( $text, $args, $parser) |
Parser hook. | |
Static Private Member Functions | |
static | getLexer ( $lang) |
Get the Pygments lexer name for a particular language. | |
static | plainCodeWrap ( $code, $inline) |
Static Private Attributes | |
static array | $mimeLexers |
Mapping of MIME-types to lexer names. | |
Definition at line 21 of file SyntaxHighlight.php.
|
staticprivate |
Get the Pygments lexer name for a particular language.
string | $lang | Language name. |
Definition at line 48 of file SyntaxHighlight.php.
References $lang, and(), and SyntaxHighlightGeSHiCompat\getGeSHiToPygmentsMap().
Referenced by highlight().
|
static |
Definition at line 177 of file SyntaxHighlight.php.
References and().
Referenced by UpdateCSS\execute(), and UpdateLexerList\execute().
|
static |
Highlight a code-block using a particular lexer.
This produces raw HTML (wrapped by Status), the caller is responsible for making sure the "ext.pygments" module is loaded in the output.
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> . |
Definition at line 222 of file SyntaxHighlight.php.
References $args, $cache, $code, $lang, $lines, $options, $output, and(), function, getLexer(), parseHighlightLines(), plainCodeWrap(), and wfWarn().
Referenced by onApiFormatHighlight(), onContentGetParserOutput(), and parserHook().
|
static |
Register parser hook.
Parser | &$parser |
Definition at line 84 of file SyntaxHighlight.php.
References $parser.
|
static |
Parser hook.
string | $text | |
array | $args | |
Parser | $parser |
MWException |
Definition at line 99 of file SyntaxHighlight.php.
References $args, $out, $parser, and(), and highlight().
|
staticprivate |
string | $code | |
bool | $inline |
Definition at line 192 of file SyntaxHighlight.php.
Referenced by highlight().
|
staticprivate |
Mapping of MIME-types to lexer names.
Definition at line 36 of file SyntaxHighlight.php.