Render form element of type text_format, keeping WYSYWIG format In Drupal 8 I have a form element fo type text_format, and I need to render it in a twig, but keeping the same format was entered in the WYSYWIG editor. I need to know how to render this element form, keeping the format? this its done in a custom form.

$form['template'] = [
  '#type' =&gt; 'text_format',
  '#title' =&gt; 'My title',
  '#rows' =&gt; 100,
  '#cols' =&gt; 120,
  '#format' =&gt; 'full_html',
];
The solution is render it using the #type =&gt; processed_text. That's it, then you will see the element renderd keeping the format used in WYSYWIG.

$elements = [
  '#type' =&gt; 'processed_text',
  '#text' =&gt; $data,
  '#format' =&gt; 'full_html',
  '#langcode' =&gt; 'en',
];