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

Html Engine not preserve newlines #3

Closed
kirsan31 opened this issue Apr 24, 2018 · 1 comment
Closed

Html Engine not preserve newlines #3

kirsan31 opened this issue Apr 24, 2018 · 1 comment

Comments

@kirsan31
Copy link

Code:

        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 = highlighter.Highlight("C#", s);
            Console.Write(highlightedCode);
            Console.ReadKey();
        }

output:

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

result:
image

@thomasjo
Copy link
Owner

The output of the HTML engine is intended to be placed within <pre>...</pre> tags.

Sadly I haven't touched this code for several years, and what little documentation used to exist at my blog is long gone by now. I'll happily merge any PR that improves the (lack of) documentation.

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