
On 3/26/25 23:57, Bruce Horrocks wrote:
On 25 Mar 2025, at 18:48, Pablo Rodriguez via ntg-context
wrote: Is this a feasible approach? I don’t need the most efficient solution, just one that I can handle and that just works.
I think relying on diff's colouring and a 1000 line change window would work but is not robust as it might unexpectedly break - e.g. if you were to port to another machine or change your terminal settings then you might get different escape sequences for the colours.
Many thanks for your reply, Bruce. Besides the fact that ConTeXt will have built-in functionality for this, I think that it would be easy for me to adapt the different escape sequences for colors (in the rather improbable case I have to port it to another machine or change my terminal settings). BTW, after I sent the message, I relalized that my approach was wrong in a detail. I wanted to add TeX commands in a Markdown source (which was going to be converted to XHTML). The right thing to do is to convert the escape sequences for colors into XML tags in the Markdown source.
An alternative might be to use 'wdiff' which does a word-based comparison instead of the line-based comparison of diff. It also allows you to insert your choice of marker string before and after each change, making it easy to insert Context markup.
I knew there was such an option, but it isn’t available for MSYS2 (just in case I might need it there one day) and as far as I can remember it compares whole words, not single characters. Many thanks for your help, Pablo