I suggest you use the Format String widget.
The 'display string' is rendered as HTML and you can use context attributes to fill the custom parts.
The Custom String is not ideal, as it makes your page load slower and causes the data to pop-in after the page has already loaded.
Did you try the latest HTML snippet widget? This contains a context version, so you should be able to use your entity data in it.
https://appstore.home.mendix.com/link/app/56/Mendix/HTML/-JavaScript-Snippet
Edit:
I have to admit I hadn't used the context version of the HTML Snippet before, but unfortunately it hasn't become clear to me how you could use it to target your entity data. Instead, for your purposes I think the CustomString widget could suffice. You can use a microflow to determine the HTML and the widget can render the HTML that you output.
https://appstore.home.mendix.com/link/app/1426/Mendix/CustomString