diff --git a/src/Parser.php b/src/Parser.php index 280ca37..b929af9 100644 --- a/src/Parser.php +++ b/src/Parser.php @@ -348,6 +348,18 @@ class Parser { } array_push($elms, $obj); + } elseif ($this->current()->type === TokenType::SPACE) { // do linebreak when two spaces are at the EOL + if ($this->last()->type === TokenType::SPACE && $this->next()->type === TokenType::EOL) { + $this->consume(); + $clearBuffer(); + $elm = $this->document->createElement("br"); + array_push($elms, $elm); + continue; + } else { + $this->consume(); + $buffer .= " "; + } + } else $buffer .= self::StripBackslashes($this->consume()->data); } @@ -672,10 +684,8 @@ class Parser { $this->parseReference(); break; case TokenType::PIPE: - if ($this->next()->type === TokenType::COLON || $this->next()->type === TokenType::MINUS) { - $this->parseTable(); - break; - } + $this->parseTable(); + break; case TokenType::GT: $this->parseBlockQuote(); break;