Drupal now has a messenger service, powered by the class Drupal\Core\Messenger\Messenger. Here is how you can add HTML to the message:

use Drupal\Core\Render\Markup;
\Drupal::messenger()->addStatus(Markup::create('Your settings have been saved. <a href="/">Go to the homepage</a>'));



Saved you some valuable time?

Buy me a drink 🍺 to keep me motivated to create free content like this!