views:

82

answers:

0

I am using the following syntax highligher:

http://alexgorbatchev.com/wiki/SyntaxHighlighter

For some reason when it encounter <br> it simply prints out <br> tags. I cannot replace the whole thing with System.Environment.NewLine since it will mess up the complete description. Here is my code:

public static string GetDescription(string description)
        {
            string codeStartPattern = "&lt;code&gt;";
            string codeEndPattern = "&lt;/code&gt;";           

            Regex reg = new Regex(codeStartPattern);
            description = reg.Replace(description, ReplaceWithStartDiv);

            reg = new Regex(codeEndPattern);
            description = reg.Replace(description, ReplaceWithEndDiv);

            return description; 
        }

 private static string ReplaceWithStartDiv(Match m)
        {
            return "<script type='syntaxhighlighter' class='brush: csharp'><![CDATA[";
        }

        private static string ReplaceWithEndDiv(Match m)
        {
            return "]]></script>"; 
        }

I guess I only need to replace <br> with System.Environment.Newline with the code that is between the <code> snippet here </code>

UPDATE ANSWER: 

Cool! I just turned on the Blogger to true and now it is working fine.