Added block/line option to process markdown

This commit is contained in:
Andy Miller
2017-03-04 13:28:43 -07:00
parent 175fcb9415
commit 90ea2fc067
2 changed files with 9 additions and 2 deletions

View File

@@ -4,6 +4,7 @@
1. [](#new)
* Added default setting to only allow `direct-installs` from official GPM. Can be configured in `system.yaml`
* Added a new `Utils::isValidUrl()` method
* Added optional parameter to `|markdown(false)` filter to toggle block/line processing (default|true = `block`)
1. [](#improved)
* Genericized `direct-install` so it can be called via Admin plugin
1. [](#bugfix)

View File

@@ -432,9 +432,10 @@ class TwigExtension extends \Twig_Extension
/**
* @param $string
*
* @param bool $block Block or Line processing
* @return mixed|string
*/
public function markdownFilter($string)
public function markdownFilter($string, $block = true)
{
$page = $this->grav['page'];
$defaults = $this->config->get('system.pages.markdown');
@@ -446,7 +447,12 @@ class TwigExtension extends \Twig_Extension
$parsedown = new Parsedown($page, $defaults);
}
$string = $parsedown->text($string);
if ($block) {
$string = $parsedown->text($string);
} else {
$string = $parsedown->line($string);
}
return $string;
}