A bigger problem is tree structures, it is particularly egregious for HTML and JSON where the output tend to be a complete mess of red and green. I think a good solution would be for git to call out to the respective language servers (the VS Language Server Protocol) and render changes based on AST and syntax specific diffs.
Re: Better Git diff output for Ruby, Python, Elixir, Go
#51If you keep each entity on a new line in both HTML and JSON it's actually quite correct.