The text itself is not formatted, the format is specified by some marking, for example, in html <strong> hola </strong>
, the label is the one that gives semantic meaning to a text in bold, the browser interprets that the text should be in bold, so when rendering the text, choose the correct typography and modifications.
You can not delete html tags without losing format , since they are yourself. My advice is that you use a different markup language, which you must convert to html (a kind of SandBox)
For example here in stackoverflow, use Markdown
The links are written as: [texto](https://enlace)
and are displayed as: text
The italics are written as: *cursiva*
and they are displayed as: italic
The titles are written as: #Título
and are displayed as:
Title
In general, there are hundreds of languages intended to format the text, some very general ones such as BBCode , Markdown , rtf , < a href="https://en.wikipedia.org/wiki/TeX"> TeX