Hacker News new | ask | show | jobs
by porpoise 2030 days ago
One of the my favorite apps, Scapple (from the same company that produces Scrivener), stores their data using just this approach (plaintext + character ranges), but in XML. It does make the data file much more readable, and it makes it possible to grep for text without having to worry about regex to skip through tags, but IMO the convenience is outweighed by the fact that there is no way to do mass search and replace (that is, using external tools) without totally messing up the formatting.

IMO the best approach is inline makeup but for the text editor to have the ability to hide tags. An example is PowerGrep's docx editor. You can open an .docx file and it will be editable entirely in plain text, but when you save it, all the formatting is preserved. In some way existing text editors (e.g. Sublime) are already capable of doing this via some kind of fold by regex functionality

1 comments

I've toyed around off and on with FUSE drivers for various purposes, and hiding information like tags and then preserving those tags on save is something you can delegate to your filesystem. The advantage is that tag-hiding now works automagically with ripgrep, your favorite editors, and any other dev tool.

You _are_ limited in that you can only detect edits during interactions with the filesystem, which is strictly less information than you'd have in an editor tracking every keystroke, but a good diffing algorithm still mostly gets the job done.