Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

c# wrong string parsing #4

Open
kirsan31 opened this issue Apr 25, 2018 · 1 comment
Open

c# wrong string parsing #4

kirsan31 opened this issue Apr 25, 2018 · 1 comment

Comments

@kirsan31
Copy link

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

@servusdei2018
Copy link
Contributor

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants