Basic code to make a module themable I almost titled the question "Hello world of theming a module", as that quite well describes what I'm looking for. I feel maybe it's to much "slang" though. There's probably a lot of people out there in this situation. I know a lot about programming, but very little about (Drupal) theming.

So, for a trivial "Hello world" module like:

function _modules_page_callback($data) {
  return '&lt;span class="module-functionality"&gt;' . $data . '&lt;/span&gt;';
}


What does the equally trivial version look like, that moves the HTML into the theme-layer?
You first let Drupal's theme system know about your "theme" functions. You just create a function called mymodule_theme and that should return an array with your theme functions defined. See hook_theme for more details. 

Example:

function mymodule_theme() {
  return array(
    'funstuff_output' =&gt; array(
      'variables' =&gt; array('node' =&gt; NULL),
    ),
  );
}


Now the 'funstuff_output' function does not exist... so create it!

function theme_funstuff_output($variables) {
  $node = $variables['node'];
  $output = '&lt;h1&gt;' . $node-&gt;title . ' is fun stuff&lt;/h1&gt;';
  return $output;
}


Now you can call taht theme function anywhere like so: print theme('funstuff_output', array('node' =&gt; $node));

In Drupal 6, I think variables is called arguments and there are some other differences. But that's the basics.