I was hoping that this would talk more about the logic behind generating a diff, rather than the optimisations involved in rendering the text.
IMO (as someone who doesn't have to deal with the actual rendering) it would go a bit deeper into talking about deciding how to show what has changed. There's a lot of improvements that could be made there. e.g. "whitespace has changed here" so there's no real code changes involved.
Or "this big list of imports has changed, and code formatting has line-wrapped the list into different lines" - gitlab for example copes poorly with this. I'd love to just see a clean diff that highlights the additional import, and not just ten lines of changes caused by adding one line to a big list of imported symbols/functions.
Most projects start with tree-sitter and then switch to language-native parsers. Either way, it's not something you solve yourself – you just find the language-specific implementation load megabytes of WASM on the frontend or generate it on the backend.
difftastic, semanticdiff.. lots of projects like that. Obviously they can offer stuff like "function name changed" instead of showing you 30 lines of +newName -oldName
> rather than the optimizations involved in rendering the text.
Any views they have on this topic is going to come across as quite opinionated given their choices for text rendering for this post and general aesthetics of website.
One of our next big projects is actually to support semantic diffs, which I think will be a lot more applicable to what you're asking for here. Currently diffs just takes a normal git patch file, or generates one from 2 versions of a file.