diff --git a/inc/parserutils.php b/inc/parserutils.php
index 599ec659f0cb75883a46e778c6c489dae929dd65..ef4541009ee6f834dd908833db8325d8f0eec888 100644
--- a/inc/parserutils.php
+++ b/inc/parserutils.php
@@ -148,16 +148,16 @@ function p_cached_output($file, $format='xhtml', $id='') {
   $cache = new cache_renderer($id, $file, $format);
   if ($cache->useCache()) {
     $parsed = $cache->retrieveCache();
-    if($conf['allowdebug']) $parsed .= "\n<!-- cachefile {$cache->cache} used -->\n";
+    if($conf['allowdebug'] && $format=='xhtml') $parsed .= "\n<!-- cachefile {$cache->cache} used -->\n";
   } else {
     $parsed = p_render($format, p_cached_instructions($file,false,$id), $info);
 
     if ($info['cache']) {
       $cache->storeCache($parsed);               //save cachefile
-      if($conf['allowdebug']) $parsed .= "\n<!-- no cachefile used, but created {$cache->cache} -->\n";
+      if($conf['allowdebug'] && $format=='xhtml') $parsed .= "\n<!-- no cachefile used, but created {$cache->cache} -->\n";
     }else{
       $cache->removeCache();                     //try to delete cachefile
-      if($conf['allowdebug']) $parsed .= "\n<!-- no cachefile used, caching forbidden -->\n";
+      if($conf['allowdebug'] && $format=='xhtml') $parsed .= "\n<!-- no cachefile used, caching forbidden -->\n";
     }
   }