MediaWiki
1.34.4
|
Static Public Member Functions | |
static | getPygmentizePath () |
static | highlight ( $code, $lang=null, $args=[]) |
Highlight a code-block using a particular lexer. More... | |
static | onParserFirstCallInit (Parser &$parser) |
Register parser hook. More... | |
static | parserHook ( $text, $args, $parser) |
Parser hook. More... | |
Static Private Member Functions | |
static | getLexer ( $lang) |
Get the Pygments lexer name for a particular language. More... | |
static | plainCodeWrap ( $code, $inline) |
Static Private Attributes | |
static array | $mimeLexers |
Mapping of MIME-types to lexer names. More... | |
Definition at line 22 of file SyntaxHighlight.php.
|
staticprivate |
Get the Pygments lexer name for a particular language.
string | $lang | Language name. |
Definition at line 49 of file SyntaxHighlight.php.
References $lang, and SyntaxHighlightGeSHiCompat\getGeSHiToPygmentsMap().
Referenced by highlight().
|
static |
Definition at line 178 of file SyntaxHighlight.php.
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 223 of file SyntaxHighlight.php.
References $args, $cache, $lang, $lines, getLexer(), makeCacheKeyHash(), parseHighlightLines(), plainCodeWrap(), and wfWarn().
Referenced by ScribuntoContent\highlight(), onApiFormatHighlight(), onContentGetParserOutput(), and parserHook().
|
static |
Register parser hook.
Parser | &$parser |
Definition at line 85 of file SyntaxHighlight.php.
References Parser\setHook().
|
static |
Parser hook.
string | $text | |
array | $args | |
Parser | $parser |
MWException |
Definition at line 100 of file SyntaxHighlight.php.
References $args, Html\closeElement(), highlight(), Html\openElement(), Html\rawElement(), and Sanitizer\validateAttributes().
|
staticprivate |
string | $code | |
bool | $inline |
Definition at line 193 of file SyntaxHighlight.php.
References Html\element(), and Html\rawElement().
Referenced by highlight().
|
staticprivate |
Mapping of MIME-types to lexer names.
Definition at line 37 of file SyntaxHighlight.php.