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
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