Render Array for hook_field_formatter_view not displaying
To add markup that's already been prepared to a render array, you would indeed use #markup. There's nothing wrong with using it where appropriate.

However, since you're preparing the markup in the same function anyway, you may as well use the render array version of the call to theme(), e.g.

$element[$delta] = array(
  '#theme' =&gt; 'mymodule_formatter',
  '#image' =&gt; $image,
  '#another_var' =&gt; 'foo',
);


It provides better structure, makes it easier for other modules to alter if necessary, and is better for caching.