Mastodon is compatible with "rich text" such as underlining, bold, italics, strikethrough, blockquotes, headers etc, and will display these correctly if a post uses them.
BUT... although it displays it, standard Mastodon doesn't let you create posts with rich text.
To create rich text posts you must use a fork of Mastodon such as Glitch, or a totally different Fediverse platform such as Friendica, Sharkey etc.
Lots more info about this topic at:
➡️ https://fedi.tips/is-mastodon-compatible-with-rich-text-formatting-such-as-markdown
Is Mastodon compatible with rich text formatting such as Markdown? | Fedi.Tips – An Unofficial Guide to Mastodon and the Fediverse
An unofficial guide to using Mastodon and the Fediversefedi.tips