Added MDE (issue #4)

This commit is contained in:
2017-09-15 13:56:24 +07:00
parent 0f011f2545
commit ec548a46b7
21 changed files with 4351 additions and 44 deletions

View File

@@ -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);
}
}