I'd like to syntax highlight Mathematica code on a MediaWiki site. I've already installed the MediaWiki extension SyntaxHighlight GeSHi and verified that it works for other languages.
I tried simply putting a Mathematica langauge data file mathematica.php
into MediaWiki's extension path wiki/extensions/SyntaxHighlight_GeSHi/geshi
, however it didn't correctly highlight a Mathematica code block such as:
<syntaxhighlight lang="Mathematica">
(* this is a comment *)
List[Sin[x], Cos[x], Tan[x]];
</syntaxhighlight>
Any ideas?
I do not see Mathematica listed as a supported language at http://qbnz.com/highlighter/, so I suppose GeSHi simply doesn't know it. I suppose you could contribute the respective highlighting code to the geshi project, if you like.
you need modify geshi.php, function get_language_name_from_extension to be specific, for added language definition to be recognized.
来源:https://stackoverflow.com/questions/17768345/how-to-enable-mathematica-syntax-highlighting-for-mediawiki-using-extension-syn