我正在使用CodeColorer插件在WordPress中显示源代码。我正在尝试将代码缩进,以便它在网站上正确显示。但是,当我尝试将以下代码添加到WYSIWYG编辑器时:
[cc lang="csharp"]
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace LittleSoftwareStats
{
public static class Config
{
public static bool Enabled { get; set; }
internal static string ApiUrl
{
get
{
UriBuilder uri = new UriBuilder((Config.ApiSecure) ? ("https") : ("http"), Config.ApiHost, Config.ApiPort, Config.ApiPath);
return uri.ToString();
}
}
internal static string AppId { get; set; }
internal static string AppVer { get; set; }
internal const string ApiHost = "stats.yourwebsitehere.com";
internal const int ApiPort = 80;
internal const bool ApiSecure = false;
internal const string ApiPath = "api."+ApiFormat;
internal const string ApiFormat = "json";
internal const string ApiUserAgent = "LittleSoftwareStatsNET";
internal const int ApiTimeout = 25000;
}
}
[/cc]
当我更新它时,代码变成:
[cc lang="csharp"]
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace LittleSoftwareStats
{
public static class Config
{
public static bool Enabled { get; set; }
internal static string ApiUrl
{
get
{
UriBuilder uri = new UriBuilder((Config.ApiSecure) ? ("https") : ("http"), Config.ApiHost, Config.ApiPort, Config.ApiPath);
return uri.ToString();
}
}
internal static string AppId { get; set; }
internal static string AppVer { get; set; }
internal const string ApiHost = "stats.yourwebsitehere.com";
internal const int ApiPort = 80;
internal const bool ApiSecure = false;
internal const string ApiPath = "api."+ApiFormat;
internal const string ApiFormat = "json";
internal const string ApiUserAgent = "LittleSoftwareStatsNET";
internal const int ApiTimeout = 25000;
}
}
[/cc]
我还尝试将空格替换为
, 和
	
和实际制表符。如果我在文本编辑器中添加制表符,它将保持不变,但当我将其切换到可视化编辑器时,它将被全部删除。我想知道是否有人知道保持代码缩进的诀窍,或者是否有办法修复它(不需要修改CodeColorer插件)?