In order to install the CodeHilight CSModule under Community Server - this CSModule works only with CS v2007 RTM - in order to download a CS v2007 RC1 version of the component get "CodeHighlight CSModule for CS v2007 RC1":
Step 1:
In communityserver.config, replace the line
<add name="ForumSourceCode" type="CommunityServer.Discussions.Components.SourceCodeModule, CommunityServer.Discussions" />
with the lines
<add name="ForumSourceCode" type="CommunityServer.Discussions.Components.SourceCodeModule, CommunityServer.Discussions" enabled="false" />
<add name="SourceCode" type="CommunityServer.CodeHighlight.CodeHighlighter, CommunityServer.CodeHighlight" />
Step 2:
Add in web.config, just under the <configuration> tag on the top of the file:
<configSections>
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="CommunityServer.CodeHighlight.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</sectionGroup>
</configSections>
<applicationSettings>
<CommunityServer.CodeHighlight.Properties.Settings>
<setting name="CodeWrapperHTML" serializeAs="String">
<value><pre style="overflow: scroll; background-color: #f2f2f2;">{0}</pre></value>
</setting>
<setting name="UseLineNumbers" serializeAs="String">
<value>False</value>
</setting>
<setting name="NumberWrapperHTML" serializeAs="String">
<value><table border="0" cellpadding="0" cellspacing="0" style="background-color: #f2f2f2; border: solid 1px #e5e5e5; width: 100%;">
<tr style="vertical-align: top; line-height: normal;">
<td style="width: 40px; text-align: right;">
<pre style="font-family: courier new; font-size: 11px; color: gray; margin: 0px; padding: 2px; border-right: solid 1px #e7e7e7;">{0}</pre></td>
<td>
<pre style="overflow: scroll; margin:0px; padding: 2px; padding-left: 8px;">{1}</pre></td>
</tr>
</table></value>
</setting>
</CommunityServer.CodeHighlight.Properties.Settings>
</applicationSettings>
Customize your installation:
The HTML code produced is surrounded with the HTML code in CodeWrapperHTML setting, and if the option to include line numbers is included - setting UseLineNumbers - then the HTML code in NumberWrapperHTML is used.
Use of [code][/code] tags:
In order to use the code highlighting in your posts use the tags [code language="C#"][/code] in a post's body. Languages supported: ASPX, C, C++, C#, COBOL, Eiffel, Fortan, Haskell, HTML, Java, Javascript, Mercury, MSIL, Pascal, Perl, PHP, Python, Ruby, SQL, Visual Basic, VBScript, VB.NET, XML. Make sure that the code pasted in your post, has no previous formating - copy the code to notepad first and then to the post's body in order to remove formating.
In order to make the HTML rendering, the CSModule uses the Highlight library of Thomas Johansen and Christian Nordbakk.
You are welcome to feedback,
George J.
george@capnias.org