Rendering plain HTML in a form I have HTML markup which is externally generated but I need to display in a form.

I've got the following code in a form controller:

public function buildForm(array $form, FormStateInterface $form_state){
    $form['phone_number'] = [
        '#type' =&gt; 'tel',
        '#title' =&gt; 'Example phone',
    ];

    $form['TEST-Cloze']   =   [
        '#markup'   =&gt;  "&lt;p&gt;&lt;select&gt;&lt;option value='[Walter]'&gt;[Walter]&lt;/option&gt;&lt;option value=' Hank'&gt; Hank&lt;/option&gt;&lt;option value=' Gus'&gt; Gus&lt;/option&gt;&lt;option value=' Jessie'&gt; Jessie&lt;/option&gt;&lt;option value=' Mike'&gt; Mike&lt;/option&gt;&lt;/select&gt; was diagnosed with cancer in his 50th year. He began working with &lt;select&gt;&lt;option value='Badger'&gt;Badger&lt;/option&gt;&lt;option value=' Skinny Pete'&gt; Skinny Pete&lt;/option&gt;&lt;option value=' [Jessie]'&gt; [Jessie]&lt;/option&gt;&lt;option value=' Tortuga'&gt; Tortuga&lt;/option&gt;&lt;option value=' Bogdan'&gt; Bogdan&lt;/option&gt;&lt;/select&gt; to produce &lt;select&gt;&lt;option value='cocaine'&gt;cocaine&lt;/option&gt;&lt;option value=' heronie'&gt; heronie&lt;/option&gt;&lt;option value=' opiods'&gt; opiods&lt;/option&gt;&lt;option value=' [amphetamines]'&gt; [amphetamines]&lt;/option&gt;&lt;option valu\nhis death. He eventually became involved with hardened criminal &lt;select&gt;&lt;option value='[Tuco]'&gt;[Tuco]&lt;/option&gt;&lt;option value=' Gomie'&gt; Gomie&lt;/option&gt;&lt;option value=' Bogdan'&gt; Bogdan\noption&gt;&lt;option value=' Todd'&gt; Todd&lt;/option&gt;&lt;option value=' Gale'&gt; Gale&lt;/option&gt;&lt;/select&gt; to help with the distribution of his illegally manufactured product.&lt;/p&gt;"
        // '#markup'   =&gt;  $question-&gt;processed
    ];

    $form['submit'] = [
        '#type' =&gt; 'submit',
        '#value' =&gt; $this-&gt;t('Submit'),
    ];

    return $form;
}


However, the output is completely stripped of markup and displays as plain text, as shown below:


How can I get the markup printed?

UPDATE:

I am attempting to add my form element markup because of the complexity of having multiple drop-down lists in a single paragraph, such as displayed below:



I struggled to achieve this type form output using other form components which is why I began looking into the #markup component.
If this was just content I would replace #markup with #prefix. It will automatically render without escaping your HTML.

However, it seems like you don't just want to render this HTML. You actually want it to interact with the Drupal Forms API. As such, I would recommend that you parse the data you need from the source and construct the form element the recommend way: 

form['example_select'] = [
  '#type' =&gt; 'select',
  '#title' =&gt; $this
    -&gt;t('Select element'),
  '#options' =&gt; [
    '1' =&gt; $this
      -&gt;t('One'),
    '2' =&gt; [
      '2.1' =&gt; $this
        -&gt;t('Two point one'),
      '2.2' =&gt; $this
        -&gt;t('Two point two'),
    ],
    '3' =&gt; $this
      -&gt;t('Three'),
  ],
];