Hacker News new | ask | show | jobs
by feifan 1366 days ago
The hard thing about plain-text is that you quickly run into domains/problems that are too complicated to easily represent as plain-text. When that happens, you run into problems: the text representation becomes really verbose (e.g. XML) or exhaustingly terse/unergonomic (e.g. LaTeX, IMO), and you can only build anemic tooling.
2 comments

one solution to this is to make an editor which is almost text but has snippets like inline images, controls, and fancy decorations. e.g. Racket snips, JetBrains MPS

another which is more of a workaround is to make the preview editable. So when the text is hard to understand or manipulate you just edit the preview, and when it’s easier you just input text. i believe this is what SwiftUI does and what people have tried with HTML and React.

of course both of these are exponentially hard. The former means you have to write your own editor and the UI for the widgets and think about a lot of problems (text wrapping? cursor movement?) The latter means you have to write a UI on freely-editable content which is really challenging and then have it sync with the text which also brings up a lot of problems (AST formatting? How fast to update?)

In fact I haven’t yet seen a single good example of either type of editor, maybe SwiftUI is good although i haven’t used it. Many existing ones are buggy with ugly unintuitive GUIs or produce bloated AST

Oh yeah completely agree. I've been working (on and off) on some designs embedding other non-text items into the sheet e.g. tables, graphs, etc. Still in the early phases but the difficulty is balancing the complexity / simplicity.