Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Highlight the changes between two similar strings
ResourceFunction["HighlightTextDifferences"][before,after] displays a string highlighting differences between before and after. |
Insertions into the text are highlighted in green:
In[1]:= | ![]() |
Out[1]= | ![]() |
Words removed from the text are displayed in red with a strikethrough:
In[2]:= | ![]() |
Out[2]= | ![]() |
Non-text expressions are converted to InputForm strings:
In[3]:= | ![]() |
Out[3]= | ![]() |
For a comparison based on the expression structure, use the resource function ExpressionLineDiff:
In[4]:= | ![]() |
Out[4]= | ![]() |
The styles for inserted and deleted text can be changed:
In[5]:= | ![]() |
Out[5]= | ![]() |
This work is licensed under a Creative Commons Attribution 4.0 International License