WYSIWYG editor is a system in which content (text and graphics) can be edited in a form closely resembling its appearance when printed or displayed as a finished product
— Wikipedia
A structure editor, also structured editor or projectional editor, is any document editor that is cognizant of the document’s underlying structure.
— Wikipedia
the plain text itself might be parsed into a AST. but you are not editing the AST, but editing that plain text, and you need to take care yourself if the edited result can be parsed or not
examples of this kind is not included in this comparison, these are basically plain text editors, with syntax highlighting. example: StackEdit
there are editors that are both structural and WYSIWYG. compare them with this example:
there are also other differences: structural editor usually has some semantical AST construction (heading), while WYSIWYG editor usually has some surface AST construction (font, font size). but there is no hard rules
structural editor might has different editing operations you can perform. also the presentation is more “WYSIWYG” than plain text editors, for example, showing a url with no url plain text (but a modal dialog to edit the url), displaying images inline (instead of a url/file name)
our data model will be similar to something like this:
Document = [Block]
Block = BlockType1(content: [Inline]) | BlockType2(blocks: [Block])
Inline = PlainText(string: String) | FormatedInline(format: Format, content: [Inline]) | EmbededImage(url: String)
so there are Document
which is a list of blocks and each block is either again some blocks (for example, Blockquote(blocks: [Block])
) or a list of Inline elements
a structural editor that layout content WYSIWYG
this is a structural editor because formatting information is stored in the AST node not in the child elements, see this:
custom tech (?)
no complex text layout support
complex selection and copy & paste behavior: there is two level of selection block level and inline level
editing commands
\
, and when this char is entered, it create a command node immediately\
char will not create a commandinteroperability with other format: import/export as LaTeX
seems all work the same to me…