diff --git a/inc/parser/xhtml.php b/inc/parser/xhtml.php
index c544d9e32904fb81b4231da8e58b26f4d6ee5e4b..c92892a355ac8c4db2dc56c11d8142da1dd9615d 100644
--- a/inc/parser/xhtml.php
+++ b/inc/parser/xhtml.php
@@ -914,7 +914,11 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
 
         // is there still an URL?
         if(!$url) {
-            $this->doc .= $name;
+            if($returnonly) {
+                return $name;
+            } else {
+                $this->doc .= $name;
+            }
             return;
         }