Upgrade to 3.7.1

This commit is contained in:
Bastian Allgeier
2022-07-12 13:33:21 +02:00
parent 7931eb5e47
commit 1ad1eaf387
377 changed files with 63981 additions and 63824 deletions

View File

@@ -20,62 +20,62 @@ use ParsedownExtra;
*/
class Markdown
{
/**
* Array with all configured options
* for the parser
*
* @var array
*/
protected $options = [];
/**
* Array with all configured options
* for the parser
*
* @var array
*/
protected $options = [];
/**
* Returns default values for all
* available parser options
*
* @return array
*/
public function defaults(): array
{
return [
'breaks' => true,
'extra' => false,
'safe' => false
];
}
/**
* Returns default values for all
* available parser options
*
* @return array
*/
public function defaults(): array
{
return [
'breaks' => true,
'extra' => false,
'safe' => false
];
}
/**
* Creates a new Markdown parser
* with the given options
*
* @param array $options
*/
public function __construct(array $options = [])
{
$this->options = array_merge($this->defaults(), $options);
}
/**
* Creates a new Markdown parser
* with the given options
*
* @param array $options
*/
public function __construct(array $options = [])
{
$this->options = array_merge($this->defaults(), $options);
}
/**
* Parses the given text and returns the HTML
*
* @param string|null $text
* @param bool $inline
* @return string
*/
public function parse(string $text = null, bool $inline = false): string
{
if ($this->options['extra'] === true) {
$parser = new ParsedownExtra();
} else {
$parser = new Parsedown();
}
/**
* Parses the given text and returns the HTML
*
* @param string|null $text
* @param bool $inline
* @return string
*/
public function parse(string $text = null, bool $inline = false): string
{
if ($this->options['extra'] === true) {
$parser = new ParsedownExtra();
} else {
$parser = new Parsedown();
}
$parser->setBreaksEnabled($this->options['breaks']);
$parser->setSafeMode($this->options['safe']);
$parser->setBreaksEnabled($this->options['breaks']);
$parser->setSafeMode($this->options['safe']);
if ($inline === true) {
return @$parser->line($text);
} else {
return @$parser->text($text);
}
}
if ($inline === true) {
return @$parser->line($text);
} else {
return @$parser->text($text);
}
}
}