added functionality to force a linebreak

by adding two spaces on the end of a line
feature/strict-mode
Michael Ochmann 3 years ago
parent 3b7e772fc7
commit 21713e2209
  1. 18
      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;

Loading…
Cancel
Save