How to provide select options rendered with HTML emphasis or spans or even hidden but still searchable with Selectize in Drupal 8

The first step, the key, is that Selectize and the Drupal module do something pretty cool. If you define options in the usual #options value, same for '#type' => 'selectize' as for #type => 'select' form elements, and also in the Selectize settings options (where options provided as a PHP array will be converted to a JavaScript object, so don’t worry about matching Selectize documentation exactly)— if you define both, any that is in Selectize options will override items with the same value in the form element’s #options.

use Drupal\selectize\Element\Selectize;

$form['services'] = [
  '#type' => 'selectize',
  '#settings' => Selectize::settings([
    'plugins' => ['remove_button'],
    'placeholder' => t('Select one or more services'),
    'options' => [
      ['value' => 'College Prep', 'text' => 'College preparation'],
    ],
  ]),
  '#title' => t('Services'),
  '#options' => $options,
  '#multiple' => TRUE,
  '#default_value' => $this->getRequest()->query->get('services'),
  '#empty_value' => '',
];

That’s the key, when we get to this work we’ll use the cleverer rendering options to get our HTML in there. The good thing about this is it leaves the options that will be shown without JavaScript, without the extra markup, meaning that they’ll actually work. That is, this way, the special stuff is only used when it can be handled. It means producing the list of options twice, in two different ways, but we’ll be automating that with Drupal.

See https://github.com/selectize/selectize.js/blob/master/docs/usage.md and https://github.com/selectize/selectize.js/blob/master/examples/customization.html for options and an example of a render function.

TODO: Update this answer with this ‘redundant’ approach, https://stackoverflow.com/questions/23206574/selectize-js-custom-rendering-with-static-html