/**
  * Register the Markdown engine implementation.
  *
  * @param  EngineResolver  $resolver
  * @return void
  */
 public function registerMarkdownEngine($resolver)
 {
     $app = $this->app;
     $resolver->register('markdown', function () use($app) {
         $cache = storage_path() . '/markdown';
         if (!File::isDirectory($cache)) {
             File::makeDirectory($cache);
         }
         $compiler = new MarkdownCompiler($app['files'], $cache);
         $compiler->setOptions(Config::get('markdown.options'));
         return new CompilerEngine($compiler, $app['files']);
     });
 }
Beispiel #2
0
 public function testTransformCodeToPre()
 {
     $compiler = new MarkdownCompiler($this->getFiles(), __DIR__);
     $compiler->setOptions(array('use_extra' => true, 'code_attr_on_pre' => true));
     $this->assertEquals('<pre><code>class Foo extends Bar {}' . PHP_EOL . '</code></pre>' . PHP_EOL, $compiler->string(file_get_contents(__DIR__ . '/fixtures/code.md')));
 }