How do I render content "as is" from custom controller I've created a custom controller that pulls content from another node (the body). That content is defined in the node as Raw HTML. 

  public function page(Request $request): array {

    $nid = $request-&gt;attributes-&gt;get('_nid');
    $node_storage = $this-&gt;entityTypeManager()-&gt;getStorage('node');
    $node = $node_storage-&gt;load($nid);
    $content = $node-&gt;get('field_content')-&gt;value;

    // Load Entity using passed NID from key.
    $build = $content;
    // Return new Response($build);
    $render_array['snippet'] = [
      '#theme' =&gt; 'webpart_snippet',
      '#content' =&gt; $build,
      '#prefix' =&gt; '&lt;div class="webpart_outer_wrapper"&gt;',
      '#suffix' =&gt; '&lt;/div&gt;',
    ];
    return $render_array;

  }


I would like to render that content as if it were a native Symfony response. (e.g., correctly parse and HTML tags AND scripts)

In the node that I'm pulling in, I have, for example

&lt;h1&gt;This is text&lt;/h1&gt; 


and that is exactly what is showing on the page 

It should be

This is text

I have defined a custom theme as well as twig template

/**
 * Implements hook_theme().
 * Declare a new theme
 */
function custom_webpart_snippet_theme() {
  return [
    'webpart_snippet' =&gt; [
      'variables' =&gt; [
        'content' =&gt; '',
      ],
    ],
  ];
}
Since this is a text area field, you need to specify a type of render element, processed_text.

$render_array['snippet'] = [
  '#theme' =&gt; 'webpart_snippet',
  '#type' =&gt; 'processed_text',
  '#text' =&gt; $node-&gt;field_content-&gt;value,
  '#format' =&gt; $node-&gt;field_content-&gt;format,
  '#prefix' =&gt; '&lt;div class="webpart_outer_wrapper"&gt;',
  '#suffix' =&gt; '&lt;/div&gt;',
];