Extracting discourse's text diffing functionality

AI-generated summary

gdpelican has extracted Discourse’s post diffing functionality into a gem called discourse-diff. This extraction is a straight port of the existing functionality and is available for others to use. zogstrip suggested that any updates or fixes should be considered for a pull request to the Discourse core. sam noted that the gem should technically be GPL-licensed, but the Discourse team is willing to waive this and allow the extraction to be MIT-licensed on a case-by-case basis. gdpelican acknowledged this and will clear any similar extractions with the team in the future.

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:
https://www.github.com/gdpelican/discourse-diff

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

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

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.

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