5

Let's say I have a source block containing a shell command that outputs some C code. For instance

#+BEGIN_SRC sh :results verbatim :exports both
echo 'const char* str = "foo";'
#+END_SRC
#+RESULTS:
: const char* str = "foo";

When I export that to HTML, for example, the shell code is fontified like shell code. However the result is not fontified, since org does not know it is actually C.

How do I fix that? Is there a way to hint that the result of some command is in another language?

Reading the documentation of :results it seems I might want use option code to specify that the output is some code, but that seems to assume the output uses the same language as the input:

#+BEGIN_SRC sh :results verbatim code :exports both
echo 'const char* str = "foo";'
#+END_SRC
#+RESULTS:
#+BEGIN_SRC sh
const char* str = "foo";
#+END_SRC

Is there a way to specify the language of the output?