How to render media shortcodes e.g [[fid:1234]]
I found the following load_file() and field_view_file() functions which worked a treat for me. I bundled them with a regex search and replace.

Rough abstract taken from my code not tested but the theory remains the same.

preg_match_all('/\[\[{"fid": ?"([0-9]+)".*?\]\]/', $tax_body, $matches);
foreach ($matches[1] as $index = &gt; $fid) {
  $file = file_load($fid); //load the file
  $content = file_view_file($file); // turn it into a render arrray
  $replacement= drupal_render($content); // render it into html string
  str_replace($matches[0][$index], $replacement, $tax_body);
}


Perform a regex for [[{"fid":(???) ..] where the ??? is the file id that is captured in the $matches[1].

Loop through all found instances, lookup the file markup, and then do a search and replace on the entire string replacing the full shortcodes (matches[0]) with the replacement markup.