Added MDE (issue #4)
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
namespace Core;
|
||||
use \Michelf\Markdown;
|
||||
|
||||
class View
|
||||
{
|
||||
@@ -9,9 +10,15 @@ class View
|
||||
{
|
||||
if (self::$twig === null) {
|
||||
$loader = new \Twig_Loader_Filesystem('../App/Views');
|
||||
$twig = new \Twig_Environment($loader);
|
||||
self::$twig = new \Twig_Environment($loader);
|
||||
|
||||
$filtermd = new \Twig_Filter('rendermd', function($string) {
|
||||
return Markdown::defaultTransform($string);
|
||||
}, ['is_safe' => ['html']]);
|
||||
|
||||
self::$twig->addFilter($filtermd);
|
||||
}
|
||||
|
||||
echo $twig->render($template, $args);
|
||||
echo self::$twig->render($template, $args);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user