How to enable Mathematica syntax highlighting for MediaWiki using extension “SyntaxHighlight GeSHi”?

江枫思渺然 提交于 2020-01-23 01:34:07

问题


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?


回答1:


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.




回答2:


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!