diff --git a/lib/reporters/doc.js b/lib/reporters/doc.js
index <HASH>..<HASH> 100644
--- a/lib/reporters/doc.js
+++ b/lib/reporters/doc.js
@@ -49,7 +49,7 @@ function Doc(runner) {
 
   runner.on('pass', function(test){
     console.log('%s<dt>%s</dt>', indent(), test.title);
-    var code = strip(test.fn.toString());
+    var code = clean(test.fn.toString());
     console.log('%s<dd><pre><code>%s</code></pre></dd>', indent(), code);
   });
 
@@ -59,11 +59,19 @@ function Doc(runner) {
 }
 
 /**
- * Strip the function definition from `str`.
+ * Strip the function definition from `str`,
+ * and re-indent for pre whitespace.
  */
 
-function strip(str) {
-  return str
-    .replace(/^function *\(.*\) *{\s*/, '')
+function clean(str) {
+  str = str
+    .replace(/^function *\(.*\) *{/, '')
     .replace(/\s+\}$/, '');
+
+  var spaces = str.match(/^\n?( *)/)[1].length
+    , re = new RegExp('^ {' + spaces + '}', 'gm');
+
+  str = str.replace(re, '');
+
+  return str;
 }
\ No newline at end of file
Fixed: strip leading indentation from doc for pre tags