It turns out that Jacob is the author of a very handy Diff action for Drafts that uses this very trick to let people compare a draft in current form to a previously saved version. It’s really cool use of a web preview and it’s something I would have used many times in Drafts had I realized it existed.
Using this, I was able to fairly easily come up with a web view showing the two files side by side with changes highlighted in the appropriate colors. My major issue with it right now is that each file is one big string, so when there are differences in the two, it doesn’t subsequently maintain side-by-side correspondence with text that is still identical between them.
I’m going to have to look at splitting each file into lines and then putting in blank sections for the lines that were deleted in one of the files so that subsequent matching text can line up again.
Still, it’s a pretty good diff tool for a few hours work. Huge thanks to Jacob for showing me the light on a way to make a lightweight diff tool immediately while I ponder a future SwiftUI diff tool app.