diff -ruN freelinking/freelinking.module freelinking-patched/freelinking.module
--- freelinking/freelinking.module	2010-04-06 16:54:26.000000000 +1000
+++ freelinking-patched/freelinking.module	2010-09-08 23:29:45.410789535 +1000
@@ -455,7 +455,7 @@
  *
 */
 
-function _freelinking_do_filtering($text, $store = FALSE) {
+function __freelinking_do_filtering($text, $store = FALSE) {
   $allowcamelcase = variable_get("freelinking_camelcase", TRUE);
   $freelinkingregexp = '/(?<![!\\\\])(\[\[.+]])/Uu'; // this finds [[links like this]], un-greedily and utf-8
   preg_match_all($freelinkingregexp, $text, $flmatches, PREG_PATTERN_ORDER);
@@ -504,6 +504,39 @@
   return $text;
 } // endfunction _freelinking_do_filtering
 
+function _freelinking_do_filtering($text, $store = FALSE) {
+  $nested = 0;
+  $index = 0;
+  $parts = array();
+  $output = "";
+
+  $first = explode('<code>', $text);
+  foreach ($first as $part) {
+    if (!$index)
+      $output .= $part;
+    else {
+      $nested++;
+      $output .= '<code>';
+      if (strstr($part, '</code>')) {
+        $parts = explode("</code>", $part);
+        foreach ($parts as $subpart) {
+          if ($nested) {
+            $nested--;
+            $output .= $subpart . "</code>";
+          }
+          else
+            $output .= __freelinking_do_filtering($subpart, $store);
+        }
+      }
+      else
+        $output .= $part;
+    }
+    $index++;
+  }
+
+  return $output;
+}
+
 function _freelinking_store($phrase, $path, $args=NULL) { // store freelinking pair in the db
   $hash = md5($phrase . $path . $args);
   $query = "SELECT hash FROM {freelinking} WHERE phrase = '%s'";
