diff --git a/lib/modules/Tools.pmod/Standalone.pmod/autodoc_to_html.pike b/lib/modules/Tools.pmod/Standalone.pmod/autodoc_to_html.pike
index c08c5c8b1d0528cbae7c6904b2b6f660c7ddbceb..bc00141d0afb021f8ff7b07e231edb2f860d649e 100644
--- a/lib/modules/Tools.pmod/Standalone.pmod/autodoc_to_html.pike
+++ b/lib/modules/Tools.pmod/Standalone.pmod/autodoc_to_html.pike
@@ -551,12 +551,11 @@ string parse_code(Node n, void|String.Buffer ret)
     text = lines*"";
   }
 
-  if (sizeof(text) && text[-1] == '\n');
-    text = text[..<1];
-
   while (text[-1] == '\n')
     text = text[..<1];
 
+  bool is_quoted = false;
+
   if (has_value(text, "->") ||
       (has_value(text, "{") && has_value(text, "}")) ||
       (has_value(text, "(") && has_value(text, "\"")) ||
@@ -566,12 +565,19 @@ string parse_code(Node n, void|String.Buffer ret)
       code_highlighter = Tools.Standalone.pike_to_html();
     }
 
+    is_quoted = true;
+
     if (catch(text = code_highlighter->convert(text))) {
       text = text;
+      is_quoted = false;
     }
   }
 
   if (ret) {
+    if (!is_quoted) {
+      text = quote(text);
+    }
+
     ret->add(text);
   }
   else return quote(text);
diff --git a/refdoc/structure/modref.css b/refdoc/structure/modref.css
index c683f619ad913009c70083b69e414a3d084ed83b..0b8efa76d5f5cd556cd4de75d3493d4a82ea295f 100644
--- a/refdoc/structure/modref.css
+++ b/refdoc/structure/modref.css
@@ -512,6 +512,11 @@ table.box td *:first-child { margin-top: 0; }
 table.box td *:last-child { margin-bottom: 0; }
 table.box table.box { width: 100%; }
 
+p + pre {
+	margin-top: -15px;
+	padding-top: 0px;
+}
+
 pre code .comment { color: #999; }
 pre code .type { color: #00007B; font-weight: bold; }
 pre code .string { color: #037F00; }