Telegram supports styled text using message entities.
A client that wants to send styled messages would simply have to integrate a Markdown/HTML parser, and generate an array of message entities by iterating through the parsed tags.
Special care must be taken to consider the UTF-8 length of strings when generating message entities, see example implementations: tdlib, MadelineProto.
Nested entities are supported.
For example the following HTML/Markdown aliases for message entities can be used:
<b>bold</b>
, <strong>bold</strong>
, **bold**
<i>italic</i>
, <em>italic</em>
*italic*
messageEntityCode
=> <code>code</code>
, `code`
<s>strike</s>
, <strike>strike</strike>
, <del>strike</del>
, ~~strike~~
<u>underline</u>
messageEntityPre
=> <pre language="c++">code</pre>
, ```c++ code ```
The following entities can also be used to mention users:
A number of other entities are also available, see the type page for the full list ยป.