Using with Orchard v1.1.30

May 28, 2011 at 3:17 PM

I'm running Orchard locally using IIS Express. I had some problems getting everything to work so here is a recap of the things I had to do.

Following example is only for C# (csharp) brush.

Modify Layout.cshtml which is under your current theme's folder and add following lines into code section. The RegisterScript/RegisterStyle doesn't seem to exist in v1.1.30.

Script.Include("sh/shCore.js", "1");   
Style.Include("sh/shCore.css", "1");       
Style.Include("sh/shThemeDefault.css", "2");
Script.Include("sh/shBrushCSharp.js", "2");  

Directly under the code section add the script tags:

<script type="text/javascript">
After that you can test the highlighter by creating new page/post. Easiest way to test is to use the "Edit HTML Source" icon in the post editor and paste following text into it:

<pre class="brush: csharp;">var foo = new Foo();


May 28, 2011 at 3:49 PM
Edited May 28, 2011 at 4:25 PM

Unfortunately IE9 doesn't like the syntax highlighter. When I initially load the page in IE9 everything works but if I reload the page in IE I get the "Can't find brush for" Works fine in Firefox 4.


Fixed the problem my removing the original script tag and adding following as the last statement of Layout.cshtml

<script type="text/javascript">syntaxHighlight('/Modules/Heikura.SyntaxHighlighter/scripts/')</script>

There is something about this error here

May 30, 2011 at 11:53 AM

Too many hours playing with different modules. I got confused about the old blog post that stated I should manually add the RegisterScript/Style lines into Layout.cshtml. There is no need to add anything. Just install the module and use the pre tags and it just works.

Jun 18, 2011 at 1:54 PM

It clearly states in the front page under Installation that you can get and install the module directly from Orchard Gallery.