Giter Site home page Giter Site logo

highlight's Introduction

  • ๐Ÿ‘‹ Howdy, I'm Thomas!
  • ๐Ÿง‘โ€๐Ÿ”ฌ I'm a machine learning researcher focusing on computer vision, drones, and autonomous systems.
  • โค๏ธ I'm extremely passionate about open source software and open access.
  • ๐Ÿ‘ด I used to work as a software engineer.
  • ๐ŸŒฑ I'm on most social platforms as thomasjo.
  • ๐Ÿ™Œ I'm always willing to help, so don't be afraid to reach out.

highlight's People

Contributors

bitdeli-chef avatar krdmllr avatar servusdei2018 avatar tathamoddie avatar thomasjo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

highlight's Issues

There's a bug in the test for CaseSensitivity in the Engine...

Hi there,

I was looking at your project to try and figure a few things out (I was curious to see if the inline styles work better for pasting code in to a document...) and I spent a little while playing with it. While I was in there, I spotted a small bug in the Engine...

if (definition.CaseSensitive) {
  return DefaultRegexOptions | RegexOptions.IgnoreCase;
}

The check is the wrong way around, it should be: if (definition.CaseSensitive == false).

I've changed it in my cloned repo, and added a test for it; happy to send over a PR if you care. Wanted to post this here just on the off-chance somebody else hits the same thing and wonders why :)

Many thanks!
Adrian

Could not load file or assembly 'System.Drawing.Common'

I get this error when calling highlighter.Highlight("JavaScript", myString):

System.IO.FileNotFoundException: 'Could not load file or assembly 'System.Drawing.Common, Version=0.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.'

I installed this library via Nuget.

I'm using .NET Core 2.1.302. Is this library compatible with .NET Core?

Version for .NET standard

Hi, would you be interested in a PR for a .NET standard 2.0 version of your code?

I just worked on it for a Blazor project and it seems to be working.

Of course, I don't know all the ins and outs of the project, so more testing may be required.

I have just used the HtmlEngine to Highlight some HTML and C# strings.

Let me know if you are interested.

Thanks for the project - it has been a help to me - I appreciate it.

Html Engine not preserve newlines

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

Stackoverflow Exception

`Private Highlighter As New Highlight.Highlighter(New Highlight.Engines.RtfEngine)

Private Sub RichTextBox1_TextChanged(sender As Object, e As EventArgs) Handles RichTextBox1.TextChanged
    RichTextBox1.Rtf = Highlighter.Highlight("Python", RichTextBox1.Text)
End Sub`

Throws a stackoverflow exception when highlighter.highlight is called for the first time. Am I doing something wrong?

c# wrong string parsing

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.