Lua error: expandTemplate: template loop detected.
The SyntaxHighlightPages extension highlights pages based on title suffixes; it depends on Extension:SyntaxHighlight.
Additionally the extension adds a Download link to the toolbox on highlighted pages.
Installation
- Install Extension:SyntaxHighlight.
- <translate> [[<tvar name=2>Special:ExtensionDistributor/Extension:SyntaxHighlightPages</tvar>|Download]] and place the file(s) in a directory called <tvar name=name>
Extension:SyntaxHighlightPages
</tvar> in your <tvar name=ext>extensions/
</tvar> folder.</translate> - <translate> Add the following code at the bottom of your <tvar name=1>LocalSettings.php </tvar> file:</translate>
wfLoadExtension( 'Extension:SyntaxHighlightPages' );
<translate> Done</translate> – <translate> Navigate to <tvar name=special>Special:Version</tvar> on your wiki to verify that the extension is successfully installed.</translate>
Configuration parameters
- $wgSyntaxHighlightPagesSuffixes
- The enabled suffixes.
For example:
$wgSyntaxHighlightPagesSuffixes = ['txt', 'html', 'css', 'xml', 'js', 'php'];
Note that the suffix needs to be a short name listed under https://pygments.org/docs/lexers/.
Unfortunately using the file extensions known to Pygments does not work since
Extension:SyntaxHighlight provides no PHP wrapper for pygments.lexers.find_lexer_class_for_filename
.
This does mean that adding e.g. 'htm'
will not work because it is not a lexer name.