Skip to content

c# wrong string parsing #4

@kirsan31

Description

@kirsan31

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions