/**
  * {@inheritdoc}
  * @param string $text The text
  */
 public function render($text)
 {
     $this->ciconia->addExtension(new Gfm\FencedCodeBlockExtension());
     $this->ciconia->addExtension(new Gfm\TaskListExtension());
     $this->ciconia->addExtension(new Gfm\InlineStyleExtension());
     $this->ciconia->addExtension(new Gfm\WhiteSpaceExtension());
     $this->ciconia->addExtension(new Gfm\TableExtension());
     $this->ciconia->addExtension(new Gfm\UrlAutoLinkExtension());
     return $this->ciconia->render($text);
 }
 /**
  * On strict mode
  *
  * @param string $name     Name of the test case
  * @param string $markdown The Markdown content
  * @param string $expected Expected output
  *
  * @dataProvider strictModeProvider
  * @expectedException \Ciconia\Exception\SyntaxError
  */
 public function testStrictMode($name, $markdown, $expected)
 {
     $ciconia = new Ciconia();
     $ciconia->addExtensions([new FencedCodeBlockExtension(), new InlineStyleExtension(), new WhiteSpaceExtension(), new TaskListExtension(), new TableExtension(), new UrlAutoLinkExtension()]);
     $html = $ciconia->render($markdown, ['strict' => true]);
     $this->assertEquals($expected, $html, sprintf('%s failed', $name));
 }
예제 #3
0
 /**
  * @param $name
  * @param $markdown
  * @param $expected
  *
  * @dataProvider pygmentsModeProvider
  */
 public function testPygmentsMode($name, $markdown, $expected)
 {
     $ciconia = new Ciconia();
     $ciconia->addExtensions([new FencedCodeBlockExtension()]);
     $html = $ciconia->render($markdown, ['pygments' => true]);
     $this->assertEquals($expected, $html, sprintf('%s failed', $name));
 }
예제 #4
0
 public function parsedDescription()
 {
     $content = $this->description;
     $parser = new Ciconia();
     $config = HTMLPurifier_Config::createDefault();
     $purifier = new HTMLPurifier($config);
     $htmltopurify = $parser->render($content);
     return $purifier->purify($htmltopurify);
 }
예제 #5
0
 /**
  * @dataProvider htmlProvider
  */
 public function testHtmlPatterns($name, $textile, $expected)
 {
     $ciconia = new Ciconia(new XhtmlRenderer());
     $ciconia->addExtensions([new \Ciconia\Extension\Html\AttributesExtension()]);
     $expected = str_replace("\r\n", "\n", $expected);
     $expected = str_replace("\r", "\n", $expected);
     $html = $ciconia->render($textile);
     $this->assertEquals($expected, $html, sprintf('%s failed', $name));
 }
예제 #6
0
 /**
  * @dataProvider textileProvider
  */
 public function testTextilePatterns($name, $textile, $expected)
 {
     $ciconia = new Ciconia();
     $ciconia->addExtensions([new HeaderExtension(), new DefinitionListExtension(), new CommentExtension()]);
     $expected = str_replace("\r\n", "\n", $expected);
     $expected = str_replace("\r", "\n", $expected);
     $html = $ciconia->render($textile);
     $this->assertEquals($expected, $html, sprintf('%s failed', $name));
 }
예제 #7
0
 /**
  * Lints the content
  *
  * @param OutputInterface $output  The OutputInterface instance
  * @param Ciconia         $ciconia The Ciconia instance
  * @param string          $content The markdown content
  *
  * @return int
  */
 protected function lint(OutputInterface $output, Ciconia $ciconia, $content)
 {
     try {
         $ciconia->render($content, array('strict' => true));
         $output->writeln('No syntax errors detected.');
         return 0;
     } catch (SyntaxError $e) {
         $output->writeln('<error>' . $e->getMessage() . '</error>');
         return 1;
     }
 }
예제 #8
0
 /**
  * {@inheritdoc}
  */
 public function transform($content)
 {
     return $this->engine->render($content);
 }
예제 #9
0
 public function renderContent()
 {
     $ciconia = new Ciconia();
     $ciconia->addExtension(new Gfm\FencedCodeBlockExtension());
     $ciconia->addExtension(new Gfm\TaskListExtension());
     $ciconia->addExtension(new Gfm\InlineStyleExtension());
     $ciconia->addExtension(new Gfm\WhiteSpaceExtension());
     $ciconia->addExtension(new Gfm\TableExtension());
     $ciconia->addExtension(new Gfm\UrlAutoLinkExtension());
     $content = $ciconia->render(@$this['body']);
     echo $content;
 }
예제 #10
0
 /**
  * Transform markdown into html
  */
 public function markdown($text, $options = array())
 {
     return $this->ciconia->render($text, $options);
 }
예제 #11
0
 /**
  * On strict mode
  *
  * @param string $name     Name of the test case
  * @param string $markdown The Markdown content
  * @param string $expected Expected output
  *
  * @dataProvider strictModeProvider
  * @expectedException \Ciconia\Exception\SyntaxError
  */
 public function testStrictMode($name, $markdown, $expected)
 {
     $ciconia = new Ciconia();
     $html = $ciconia->render($markdown, ['strict' => true]);
     $this->assertEquals($expected, $html, sprintf('%s failed', $name));
 }
예제 #12
0
 /**
  * {@inheritdoc}
  */
 public function run($markdown = '')
 {
     return $this->ciconia->render($markdown);
 }