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); 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 } else
$buffer .= self::StripBackslashes($this->consume()->data); $buffer .= self::StripBackslashes($this->consume()->data);
} }
@ -672,10 +684,8 @@ class Parser {
$this->parseReference(); $this->parseReference();
break; break;
case TokenType::PIPE: case TokenType::PIPE:
if ($this->next()->type === TokenType::COLON || $this->next()->type === TokenType::MINUS) { $this->parseTable();
$this->parseTable(); break;
break;
}
case TokenType::GT: case TokenType::GT:
$this->parseBlockQuote(); $this->parseBlockQuote();
break; break;

Loading…
Cancel
Save