📄 codehighlightingmodule.cs
字号:
namespace CommunityServer.FreeTextBoxWrapper
{
using CommunityServer.Components;
using System;
using System.Xml;
public class CodeHighlightingModule : ICSModule
{
private void csa_BeforeProcessPost(IContent content, CSPostEventArgs e)
{
if (((e.ApplicationType == ApplicationType.Weblog) || (e.ApplicationType == ApplicationType.Forum)) && (((e.State == ObjectState.Create) || (e.State == ObjectState.Update)) || (e.State == ObjectState.Runtime)))
{
string text1;
CodeBlockHighlighter highlighter1 = new CodeBlockHighlighter();
string text2 = string.Format("{0}", content.GetType());
if (((text1 = text2) != null) && (text1 == "CommunityServer.Components.IndexPost"))
{
IndexPost post1 = content as IndexPost;
post1.FormattedBody = highlighter1.Highlight(post1.FormattedBody, true);
}
else
{
Post post2 = content as Post;
post2.FormattedBody = highlighter1.Highlight(post2.FormattedBody, true);
}
}
}
public void Init(CSApplication csa, XmlNode node)
{
csa.PreRenderPost += new CSPostEventHandler(this.csa_BeforeProcessPost);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -