diff --git a/inc/parser/handler.php b/inc/parser/handler.php
index 58b68bc42084c29fc5f11a320ac1ff1b3086e18f..c92dbe3d59e4bcc0aa4b530225087faf1d86e466 100644
--- a/inc/parser/handler.php
+++ b/inc/parser/handler.php
@@ -1050,6 +1050,9 @@ class Doku_Handler_Preformatted {
                     if (trim($this->text)) {
                       $this->CallWriter->writeCall(array('preformatted',array($this->text),$this->pos));
                     }
+                    // see FS#1699 & FS#1652, add 'eol' instructions to ensure proper triggering of following p_open
+                    $this->CallWriter->writeCall(array('eol',array(),$this->pos));
+                    $this->CallWriter->writeCall(array('eol',array(),$this->pos));
                 break;
             }
         }
diff --git a/inc/parser/parser.php b/inc/parser/parser.php
index ba62af21e6ea093b068e7e2925b298d2cf9154a6..77909a436697f56830a34171892d3f8cad5f114e 100644
--- a/inc/parser/parser.php
+++ b/inc/parser/parser.php
@@ -276,7 +276,8 @@ class Doku_Parser_Mode_eol extends Doku_Parser_Mode {
         if ( in_array($mode, $badModes) ) {
             return;
         }
-        $this->Lexer->addSpecialPattern('\n',$mode,'eol');
+        // see FS#1652, pattern extended to swallow preceding whitespace to avoid issues with lines that only contain whitespace
+        $this->Lexer->addSpecialPattern('(?:^[ \t]*)?\n',$mode,'eol');
     }
 
     function getSort() {