![](https://programming.dev/pictrs/image/cad7d06a-4705-4a30-aef4-071535d562cb.jpeg)
![](https://programming.dev/pictrs/image/8140dda6-9512-4297-ac17-d303638c90a6.png)
There are markup languages for this purpose. And you store the rich text as normal text in that markup language. For the most part.
It’s typically an XML or XML-like language, or bb-codes. MS Word for example uses XML to store the markup data for the rich text.
Simpler and more limited text needs tend to use markdown these days, like Lemmy, or most text fields on GitHub.
There’s no need to include complex technology stacks into it!
Now the real hard part is the rendering engine for WYSIWYG. That’s a nightmare.
Probably not. Having actually played with making a WYSIWYG editor as a learning project markdown is too simplistic for the formatting needs of any non-trivial text editing, as a serialized storage format.
You almost always end up back with your own data structure that you serialize into something like XML for storage. Or you end up supporting HTML or non-spec compliant syntax in your markdown.
And if you care about performance, you’re not actually working with XML, HTML, or Markdown in memory. You’re working with a data structure that you have to serialize/deserialize from your storage format. This is where markdown becomes a bit more tedious since it’s not as easy to work with in this manner, and you end up with a weird parsing layer in-between the markdown and your runtime data structures.
The commenter that’s downvoted is more correct than not IMHO (Also why are we downloading discussions??). Markdown is ill suited for “most WYSIWYG needs”. It tends to get augmented with XML or custom non-spec compliant syntax. The spec poorly supports layout (columns, image & media positioning, sizing…etc) and styling (font color, size, family, backgrounds…etc)