Giter Site home page Giter Site logo

thezaza101 / textdiffcore Goto Github PK

View Code? Open in Web Editor NEW
6.0 1.0 4.0 155 KB

Cross platform diff engine for .net core used to compare string values and generate a comparison output

License: MIT License

C# 100.00%
diff compare-strings dotnet-core text-compression html markdown dotnet dotnetcore myers-algorithm

textdiffcore's Introduction

textdiffcore

Crossplatform diff engine for .net core

Build Status

How to use

Check out this blog post for a detailed write up.

Install the package

Package Manager:

PM> Install-Package textdiffcore -Version 1.0.3

.NET CLI

dotnet add package textdiffcore --version 1.0.3

Packet CLI

paket add textdiffcore --version 1.0.3

In your code...

using textdiffcore;
using textdiffcore.DiffOutputGenerators;
using textdiffcore.TextDiffEngine;


...
TextDiff diffobj = new TextDiff(new MyersDiff(), new HTMLDiffOutputGenerator("span", "style", "color:#003300;background-color:#ccff66;","color:#990000;background-color:#ffcc99;text-decoration:line-through;",""));

string oldText = "The quick brown fox jumps over the lazy dog";
string newText = "A quick cat jumps over the lazy sleeping dog";
string output =  diffobj.GenerateDiffOutput(oldText,newText);

output is: Output HTML

Which looks like this in a web browser: Output HTML after rendering

How to implement your own output engine or text comparison engine

TBA

License

This software is released under the MIT License

Notice

The classes within 'DiffMatchPatch.cs' is (C) 2018 The diff-match-patch Authors, it is used here under its Apache v2.0 License.

Found a bug?

If you've found a bug please file a new issue.

Making contributions

To propose a change, you first need to create a GitHub account.

Once you're signed in, you can browse through the folders above and choose the content you're looking for. You should then see the content in Markdown form. Click the Edit icon in the top-right corner to start editing the content.

The content is written in the Markdown format. There's a guide here on how to get started with it.

You can preview your changes using the tabs at the top of the editor.

When you're happy with your change, make sure to create a pull request for it using the options at the bottom of the page. You'll need to write a short description of the changes you've made.

A pull request is a proposal for a change to the content. Other people can comment on the change and make suggestions. When your change has been reviewed, it will be "merged" - and it will appear immediately in the published content.

Take a look at this guide on GitHub about pull requests.

textdiffcore's People

Contributors

thezaza101 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

textdiffcore's Issues

Unit test #12 does not pass

Unit test = #12 Multiple remove ("The quick brown fox" vs "quick fox")

Expected pattern "RERE" vs Actual pattern "RRRE"

Expected output (Inner List):
Remove The
Equal quick
Remove brown
Equal fox

Actual output (Inner List):
Remove The
Remove quick
Remove brown
Add quick

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.