Extracting discourse's text diffing functionality


(James Kiesel) #1

I’ve recently found myself with a need for Discourse’s excellent post diffing functionality in a project.

Normally for a project like this I’d take a look at Discourse’s code and re-implement it to my taste, but this time it struck me as an great library to extract (given that it’s self-contained and uses a computer-sciency algorithm with a fancy name and whatnot)

I’ve extracted it to a gem here:

Which is a straight port of the existing functionality, no fiddling necessary, for anyone else who might need such a thing.

(PS, more than happy to transfer ownership of this to the Discourse team if they want that, as long as I can keep using it :slight_smile: )


(Régis Hanol) #2

That’s cool. If you do any update/fix, please consider making a PR to core as well :wink:


(Sam Saffron) #3

Note, strictly the gem should be GPL, but we are OK to waive that and allow this particular extraction to be MIT (similar to how onebox is MIT). Please note you need to clear this kind of stuff with us on a case-by-case basis.


(James Kiesel) #4

Ah yes, that was my intention in creating this post was to make sure you were aware it existed and could make adjustments to it as you saw fit; I was following onebox’s lead on licensing as the only other gem I knew of that was extracted from core.

I’ll be sure to check in specifically if this situation comes up again