Extension:SyntaxHighlight
(Redirected from Extension:SyntaxHighlight GeSHi)
|
SyntaxHighlight | |
---|---|
Version | 2.0 |
Author(s) | Brion Vibber, Tim Starling, Rob Church, Niklas Laxström, Ori Livneh and Ed Sanders |
Extension link | MediaWiki.org |
Description | |
Provides syntax highlighting <syntaxhighlight> using Pygments - Python syntax highlighter
|
SyntaxHighlight, formerly known as SyntaxHighlight_GeSHi, is an extension that adds syntax highlighting based on the Pygments syntax highlighting library.
Contents
Usage[edit | edit source]
<syntaxhighlight> code here </syntaxhighlight>
Parameters[edit | edit source]
lang=
- The code's language to determine the highlighting algorithm. For a full list of supported languages, see the Pygments documentation.
line
- Enables line numbers.
start=
- Starting number for the line numbers, if
line
is enabled.
highlight=
- Comma-separated list of lines to add background highlighting.
inline
- Display the code block inline with surrounding text.
class=
- Adds CSS classes to the code block to allow for additional styling.
style=
- Adds inline CSS styles to the code block.
Examples[edit | edit source]
lang[edit | edit source]
<syntaxhighlight lang="css">
Result:
div.skill-table {
margin: 2.1rem;
border-collapse:collapse;
}
line[edit | edit source]
<syntaxhighlight lang="css" line>
Result:
1 div.skill-table {
2 margin: 2.1rem;
3 border-collapse:collapse;
4 }
start[edit | edit source]
<syntaxhighlight lang="css" line start=5>
Result:
5 div.skill-table {
6 margin: 2.1rem;
7 border-collapse:collapse;
8 }
highlight[edit | edit source]
<syntaxhighlight lang="css" highlight="1,4">
Result:
div.skill-table {
margin: 2.1rem;
border-collapse:collapse;
}
inline[edit | edit source]
<syntaxhighlight lang="css" inline>
Result:
div.skill-table { margin: 2.1rem; border-collapse:collapse; }