I will put this here just in case it saves time someone i the future - using Html.Raw did not seem to help in a razor component on .Net 8 . Using conversion to MarkupString did solve the issue
<p>Your text msg: @((MarkupString) msg) </p>