added `strict` mode

feature/strict-mode
Michael Ochmann 3 years ago
parent 0cc7b0dd45
commit 18067b6e56
  1. 6
      src/Parkdown.php

@ -8,11 +8,11 @@ class Parkdown {
private string $sourceCode;
private DOMDocument $tree_;
public function __construct(string $sourceCode) {
public function __construct(string $sourceCode, bool $strict = false, ?string $fileName = null) {
$this->sourceCode = $sourceCode;
$lexer = new Lexer($this->sourceCode);
$parser = new Parser($lexer->tokenize());
$lexer = new Lexer($this->sourceCode, $fileName);
$parser = new Parser($lexer->tokenize(), $strict);
$this->tree_ = $parser->parse();
}

Loading…
Cancel
Save