How can you make an HTML link? I need a link with another render array around it. More specifically I need a link around an image. 

In the D7 days I'd just use a render array of type link and then set HTML to true and set the text as the image.

I was hoping to put it in a preprocess function.
The HTML attribute removal was documented in change record #2932803, but the example uses the now deprecated SafeMarkup::format function. The FormattableMarkup class allows a non-deprecated way to do this. The API page has some good examples such as below:

Remember that this is has security implications, and to only use FormattableMarkup when you absolutely need it with strict placeholders.

$value = FormattableMarkup::placeholderFormat('&lt;a href=":url"&gt;@variable&lt;/a&gt;', [':url' =&gt; $url, @variable =&gt; $variable]);


There's probably a better way to do this without printing the anchor element and href attribute yourself.