diff --git a/api.module b/api.module
index 48b7d7c..cb93f33 100644
--- a/api.module
+++ b/api.module
@@ -2031,7 +2031,7 @@ function api_cron() {
  *   Code with function names formatted as links.
  */
 function api_link_code($code, $branch, $class_did = NULL) {
-  return _api_link_documentation($code, $branch, $class_did, array('code function', 'code string'));
+  return _api_link_documentation($code, $branch, $class_did, array('code hook name', 'code theme hook name', 'code function', 'code string'));
 }
 
 /**
@@ -2112,6 +2112,13 @@ function _api_link_documentation($documentation, $branch, $class_did = NULL, $st
     // '('.
     'function' => '!(?<=^|\s)([a-zA-Z0-9_:]+)\(!',
 
+    // Find potential hook names in marked-up code inside a module_implements()
+    // or module_invoke_all() call.
+    'code hook name' => '!(?<=module_invoke_all</span>\(|module_implements</span>\(|module_invoke</span>\(<span\ class="php-variable">\$module</span>, )<span class="php-string">\'([a-zA-Z0-9_]+)\'</span>!',
+
+    // Find potential theme hook names in marked-up code inside a theme() call.
+    'code theme hook name' => '!(?<=theme</span>\()<span class="php-string">\'([a-zA-Z0-9_]+)\'</span>!',
+
     // Find function names in marked-up code.
     'code function' => '!<span class="php-function-or-constant">([a-zA-Z0-9_]+)</span>!',
 
@@ -2162,6 +2169,22 @@ function _api_link_documentation($documentation, $branch, $class_did = NULL, $st
       $prepend_if_not_found = '<span class="php-string">\'';
       $use_php = FALSE;
       break;
+
+    case 'code hook name':
+      $prepend = '<span class="php-function-or-constant">\'';
+      $append = '\'</span>';
+      $prepend_if_not_found = '<span class="php-string">\'';
+      $use_php = FALSE;
+      $type = 'hook';
+      break;
+
+    case 'code theme hook name':
+      $prepend = '<span class="php-function-or-constant">\'';
+      $append = '\'</span>';
+      $prepend_if_not_found = '<span class="php-string">\'';
+      $use_php = FALSE;
+      $type = 'theme';
+      break;
   }
 
   if (count($stages) > 0) {
@@ -2171,7 +2194,7 @@ function _api_link_documentation($documentation, $branch, $class_did = NULL, $st
     $callback = NULL;
   }
 
-  return api_split($patterns[$stage], $documentation, $callback_match, array($branch, $prepend, $append, $class_did, NULL, NULL, $use_php, $prepend_if_not_found), $callback, array($branch, $class_did, $stages));
+  return api_split($patterns[$stage], $documentation, $callback_match, array($branch, $prepend, $append, $class_did, NULL, NULL, $use_php, $prepend_if_not_found, NULL, $type), $callback, array($branch, $class_did, $stages));
 }
 
 /**
@@ -2247,11 +2270,16 @@ function api_split($pattern, $subject, $callback_match = NULL, $callback_match_a
  *   Text to prepend if object is not found (defaults to $prepend).
  * @param $append_if_not_found
  *   Text to append if object is not found (defaults to $append).
+ * @param $type
+ *   The type of information $name represents. Possible values:
+ *   - '': (default) $name is a normal object name.
+ *   - 'hook': $name is a hook name.
+ *   - 'theme': $name is a theme hook name.
  *
  * @return
  *   The text as a link to the object page.
  */
-function api_link_name($name, $branch, $prepend = '', $append = '', $class_did = NULL, $text = NULL, $is_link = FALSE, $use_php = TRUE, $prepend_if_not_found = NULL, $append_if_not_found = NULL) {
+function api_link_name($name, $branch, $prepend = '', $append = '', $class_did = NULL, $text = NULL, $is_link = FALSE, $use_php = TRUE, $prepend_if_not_found = NULL, $append_if_not_found = NULL, $type = '') {
   static $local_objects = array(), $php_functions;
 
   if (!isset($local_objects[$class_did])) {
@@ -2343,6 +2371,20 @@ function api_link_name($name, $branch, $prepend = '', $append = '', $class_did =
   if ($is_link && isset($local_objects[$class_did]['group'][$name])) {
     return $prepend . l($text, $local_objects[$class_did]['group'][$name]['url'], $local_objects[$class_did]['group'][$name]['options']) . $append;
   }
+  elseif ($type == 'hook') {
+    if (isset($local_objects[$class_did]['item']['hook_' . $name])) {
+      return $prepend . l($text, $local_objects[$class_did]['item']['hook_' . $name]['url'], $local_objects[$class_did]['item']['hook_' . $name]['options']) . $append;
+    }
+  }
+  elseif ($type == 'theme') {
+    $template_name = str_replace('_', '-', $name) . '.tpl.php';
+    if (isset($local_objects[$class_did]['item'][$template_name])) {
+      return $prepend . l($text, $local_objects[$class_did]['item'][$template_name]['url'], $local_objects[$class_did]['item'][$template_name]['options']) . $append;
+    }
+    elseif (isset($local_objects[$class_did]['item']['theme_' . $name])) {
+      return $prepend . l($text, $local_objects[$class_did]['item']['theme_' . $name]['url'], $local_objects[$class_did]['item']['theme_' . $name]['options']) . $append;
+    }
+  }
   elseif (isset($local_objects[$class_did]['item'][$name])) {
     return $prepend . l($text, $local_objects[$class_did]['item'][$name]['url'], $local_objects[$class_did]['item'][$name]['options']) . $append;
   }
