Merge branch 'fix/update-paresdown' into fix-compatibility-php8
This commit is contained in:
commit
0187138622
@ -35,8 +35,8 @@
|
|||||||
"ext-mbstring": "*",
|
"ext-mbstring": "*",
|
||||||
"twig/twig": "^2.12",
|
"twig/twig": "^2.12",
|
||||||
"symfony/yaml" : "^3.4",
|
"symfony/yaml" : "^3.4",
|
||||||
"erusev/parsedown": "1.7.4",
|
"erusev/parsedown": "^2.0.0-beta-1",
|
||||||
"erusev/parsedown-extra": "0.8.1"
|
"erusev/parsedown-extra": "^2.0.0-beta-1"
|
||||||
},
|
},
|
||||||
"suggest": {
|
"suggest": {
|
||||||
"picocms/pico-theme": "Pico requires a theme to actually display the contents of your website. This is Pico's official default theme.",
|
"picocms/pico-theme": "Pico requires a theme to actually display the contents of your website. This is Pico's official default theme.",
|
||||||
|
24
lib/Pico.php
24
lib/Pico.php
@ -42,6 +42,12 @@
|
|||||||
* @license http://opensource.org/licenses/MIT The MIT License
|
* @license http://opensource.org/licenses/MIT The MIT License
|
||||||
* @version 3.0
|
* @version 3.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
use Erusev\Parsedown\Configurables\Breaks;
|
||||||
|
use Erusev\Parsedown\Parsedown;
|
||||||
|
use Erusev\Parsedown\State;
|
||||||
|
use Erusev\ParsedownExtra\ParsedownExtra;
|
||||||
|
|
||||||
class Pico
|
class Pico
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
@ -1561,12 +1567,13 @@ class Pico
|
|||||||
public function getParsedown()
|
public function getParsedown()
|
||||||
{
|
{
|
||||||
if ($this->parsedown === null) {
|
if ($this->parsedown === null) {
|
||||||
$className = $this->config['content_config']['extra'] ? 'ParsedownExtra' : 'Parsedown';
|
$state = new State([
|
||||||
$this->parsedown = new $className();
|
new Breaks((bool) $this->config['content_config']['breaks'])
|
||||||
|
]);
|
||||||
$this->parsedown->setBreaksEnabled((bool) $this->config['content_config']['breaks']);
|
if ($this->config['content_config']['extra']){
|
||||||
$this->parsedown->setMarkupEscaped((bool) $this->config['content_config']['escape']);
|
$state = new ParsedownExtra($state);
|
||||||
$this->parsedown->setUrlsLinked((bool) $this->config['content_config']['auto_urls']);
|
}
|
||||||
|
$this->parsedown = new Parsedown($state);
|
||||||
|
|
||||||
$this->triggerEvent('onParsedownRegistered', array(&$this->parsedown));
|
$this->triggerEvent('onParsedownRegistered', array(&$this->parsedown));
|
||||||
}
|
}
|
||||||
@ -1666,14 +1673,13 @@ class Pico
|
|||||||
* @see Pico::getFileContent()
|
* @see Pico::getFileContent()
|
||||||
*
|
*
|
||||||
* @param string $markdown Markdown contents of a page
|
* @param string $markdown Markdown contents of a page
|
||||||
* @param bool $singleLine whether to parse just a single line of markup
|
|
||||||
*
|
*
|
||||||
* @return string parsed contents (HTML)
|
* @return string parsed contents (HTML)
|
||||||
*/
|
*/
|
||||||
public function parseFileContent($markdown, $singleLine = false)
|
public function parseFileContent($markdown)
|
||||||
{
|
{
|
||||||
$markdownParser = $this->getParsedown();
|
$markdownParser = $this->getParsedown();
|
||||||
return !$singleLine ? @$markdownParser->text($markdown) : @$markdownParser->line($markdown);
|
return @$markdownParser->toHtml($markdown);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user