Mediawiki <source />标签没有着色我的代码部分

时间:2016-04-27 17:47:03

标签: syntax-highlighting mediawiki

我有一个小wiki,使用 MediaWiki 1.26.2 供个人使用,在一篇文章中包含此部分文字:

<source enclose=div lang=php>
    $wgGroupPermissions['*']['createaccount'] = false;
</source>

它显示了下一个结果:

syntaxhighlight without coloring

而不是

syntaxhighlight with coloring

我的意思是,已经格式化,但没有着色,我的理解是它应该是多彩的,无论wiki使用的是什么样的皮肤,所以是否有我缺少的配置?

3 个答案:

答案 0 :(得分:0)

语法highlighter extension 最近的MediaWiki安装捆绑在一起,但默认情况下未安装。你需要在LocalSettings.php中启用它,就像这样(对于MediaWiki 1.24和更新版本):

using GalaSoft.MvvmLight;
using GalaSoft.MvvmLight.Command;
using StoreFront.Models;
using StoreFront.Services;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;


namespace StoreFront.ViewModels {
    public class MainWindowViewModel : ViewModelBase,IMainViewModel {

        private IDataService dataService;

        IDialogService dialogService;
        IStorageService storageService;

        public MainViewModel(IDataService dataService, IStorageService storageService) {
            this.dataService = dataService;
            this.storageService = storageService; 

            RefreshAsync(); //Basically fills the product ObservableCollection with data.
        }

        private ObservableCollection<Product> product = new ObservableCollection<Product>();
        public ObservableCollection<Product> Product {
            get {
                return product;
            }
        }

}

答案 1 :(得分:0)

我能够解决问题,我正在发布解决方案以防其他人遇到同样的问题。我将我的Wiki托管在godaddy.com中,作为服务的一部分,您可以安装Application 开箱即用,其中一个是MediaWiki,已经安装了 SyntaxHighlight 扩展

由于某些原因我不够清楚,这个扩展程序无法正常工作,所以我决定自己从here安装扩展程序,这次它就像魅力一样。

答案 2 :(得分:0)

MediaWiki 1.32上的 SyntaxHighlight_GeSHi 似乎还有更多相同的问题。
替代方法是:Highlightjs
(它使用js进行语法高标)

它可以直接使用,甚至不必从 SyntaxHighlight_GeSHi 更改先前定义的代码语法。