Code Highlight: Difference between revisions
Jump to navigation
Jump to search
(→Module) |
|||
Line 14: | Line 14: | ||
== Sample code == | == Sample code == | ||
<pre> | <pre> | ||
<syntaxhighlight lang="php"> | |||
<?php | |||
$v = "string"; // sample initialization | |||
?> | |||
html text | |||
<? | |||
echo $v; // end of php code | |||
?> | |||
</syntaxhighlight> | |||
</pre> | </pre> | ||
Revision as of 17:09, 15 November 2014
Module
Download module at SyntaxHighlight_GeSHi
tar -xzf SyntaxHighlight_GeSHi-REL1_23-4959271.tar.gz -C /var/www/mediawiki/extensions
Setup
Copy file into extensions folder Add the following code at the end of LocalSettings.php
require_once "$IP/extensions/SyntaxHighlight_GeSHi/SyntaxHighlight_GeSHi.php"; $wgSyntaxHighlightDefaultLang = "php";
Sample code
<syntaxhighlight lang="php"> <?php $v = "string"; // sample initialization ?> html text <? echo $v; // end of php code ?> </syntaxhighlight>
Result
Supported Languages
These are the languages known by GeSHi that can be used in the lang parameter.
Note that installed GeSHi version (can be revealed by previewing e.g. <syntaxhighlight lang="-"></syntaxhighlight>
) might not be the most recent version; see bugzilla:10967 for Wikimedia sites.
The GeSHi sources for each language can be found in VCS on SourceForge. Remember to go and select the version that the MediaWiki installation uses.