How to create a menu option with HTML in its title from a module?
Modules can implement preprocess and process functions for theme functions using a template file; for theme functions not using a template file, Drupal 7 allows module to implement a preprocess function.
For example, the mymodule module could implement mymodule_preprocess_menu_link() which is a Drupal 7 preprocess function for theme_menu_link().

Preprocess and process functions are useful when the variables passed to the theme function need to be changed. If there is the need of changing the output of the theme function, then a module needs to implement hook_theme_registry_alter() and change the function called to serve the output of a theme function.

function mymodule_theme_registry_alter(&amp;$theme_registry) {
  if (isset($theme_registry['menu_link'])) {
    $theme_registry['menu_link']['function'] = 'theme_mymodule_menu_link';
  }
}


With this implementation, theme_mymodule_menu_link() would be the function called when a module calls theme('menu_link', /* … */).

References


theme()