Pass raw html to #markup
Use inline template:

  return [
    '#type' =&gt; 'inline_template',
    '#template' =&gt; '{{ somecontent }}',
    '#context' =&gt; [
      'somecontent' =&gt; $somecontent
    ]
  ];


In your case without context, just straight up html.

You can also use the html_tag element for things like script or link and so on.