Where and why are style tags removed in the render process? I have a block (in Drupal 8) that renders a field of a node. This is my build function:

public function build() {
  $node = $this-&gt;getNode();
  $build = array();
  $markup = array();
  $current_lang = \Drupal::languageManager()-&gt;getCurrentLanguage()-&gt;getId();

  if ($node &amp;&amp; $node-&gt;hasTranslation($current_lang)) {
    $node = $node-&gt;getTranslation($current_lang);
  }
  else {
    $node = false;
  }

  if ($node) {
    $fieldsToRender = array(
      'field_slider',
    );

    $viewmode = 'default';
    $entityType = 'node';
    $display = $this-&gt;getEntityViewDisplay();
    $viewBuilder = \Drupal::entityTypeManager()-&gt;getViewBuilder($entityType);

    foreach ($fieldsToRender as $field_name) {
      if (isset($node-&gt;{$field_name}) &amp;&amp; $field = $node-&gt;{$field_name}) {

        $displayComponentSettings = $display-&gt;getComponent($field_name);

        if (!is_array($displayComponentSettings)) {
          $displayComponentSettings = array();
        }

        $fieldRenderable = $viewBuilder-&gt;viewField($field, $displayComponentSettings);
        if (count($fieldRenderable) &amp;&amp;! empty($fieldRenderable)) {
          $rendered = render($fieldRenderable);

          if ('' !== $rendered) {
            $markup[] = $rendered;
          }
        }
      }  
    }

    if (count($markup)) {
      $build = array(
        '#type' =&gt; 'markup',
        '#markup' =&gt; implode("", $markup),
      );
    }
  }

  return $build;
}


When I dpm($rendered) after $rendered = render($fieldRenderable); it gives me the wanted markup, in which at some point is an inline style tag that comes from inside a paragraph's template.

For some reason though, the inline style tag is removed in the final block output. I thought it was maybe due to the filters in the page.html.twig but just rendering the region using {{ page.regionname }} makes no difference.

So, where (and why) does Drupal strip that style tag?

PS: I also noticed in the block version of the field strips the twig debug comments, while the above mentioned dpm output still contains them. So I guess it has something to do with how the block handles the build function's returned markup...
To complete Clive answer, you could directly use your $fieldRenderable variable into a new renderable array that you will return from your build() function.

Example (not tested) :

$build = [];
foreach ($fieldsToRender as $field_name) {
  // Do your stuff
  $build[] = $fieldRenderable; // you can put whatever you want for the key
}
return $build;


The render process is done when you return the $build variable.