thomasjo/highlight

c# wrong string parsing

kirsan31 opened this issue · 1 comments

Same example as #3.

        static void Main(string[] args)
        {
            var highlighter = new Highlighter(new HtmlEngine());
            var s = @"        static void Main(string[] args)
        {
            var highlighter = new Highlighter(new HtmlEngine());
            var s = @"";
            var highlightedCode = highlighter.Highlight(""C#"", s);
            Console.Write(highlightedCode);
            Console.ReadKey();
        }";
            var highlightedCode = "<pre>" + highlighter.Highlight("C#", s) + "</pre>";
            Console.Write(highlightedCode);
            Console.ReadKey();
        }

output:

<pre><span style="color: Black;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;">        <span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;">static</span> <span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;">void</span> Main(<span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;">string</span>[] args)
        {
            var highlighter <span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;">=</span> <span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;">new</span> Highlighter(<span style="color: Blue;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;">new</span> HtmlEngine());
            var s <span style="color: Red;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;">=</span> <span style="color: #666666;background-color: Transparent;font-family: Courier New;font-size: 11px;font-weight: normal;">@&quot;;
            var highlightedCode = highlighter.Highlight(&quot;</span>C#&quot;, s);
            Console.Write(highlightedCode);
            Console.ReadKey();
        }</span></pre>

result:
image

@kirsan31, this:

var s = @"";

doesn't match what you gave the highlighter:

var s = @";

Perhaps it's the lack of the second " that causes the highlighter to display it as such.