Skip to content

Instantly share code, notes, and snippets.

@simensen
Created January 5, 2012 18:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save simensen/1566621 to your computer and use it in GitHub Desktop.
Save simensen/1566621 to your computer and use it in GitHub Desktop.
<?php
/*
* This file is a part of the PHP Markdown library.
*
* (c) Dragonfly Development Inc.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace dflydev\markdown;
class SundownParser implements IMarkdownParser {
protected $cfg = array();
/**
* (non-PHPdoc)
* @see dflydev\markdown.IMarkdownParser::transformMarkdown()
*/
public function transformMarkdown($text)
{
$sundown = new \Sundown($text, $this->cfg);
return $sundown->to_html();
}
public function configureMarkdownParser($key, $value)
{
$this->cfg[$key] = $value;
}
}
<?php
/*
* This file is a part of the PHP Markdown library.
*
* (c) Dragonfly Development Inc.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace dflydev\tests\markdown;
class SundownParserTest extends AbstractParserTest
{
protected function assertSundownExtensionLoaded()
{
if (!extension_loaded('sundown')) {
$this->markTestSkipped('The Sundown extension is not available');
}
}
/**
* (non-PHPdoc)
* @see dflydev\tests\markdown.AbstractParserTest::createParser()
*/
public function createParser()
{
$this->assertSundownExtensionLoaded();
$markdownParser = new \dflydev\markdown\SundownParser();
print_r($markdownParser);
return $markdownParser;
}
/**
* (non-PHPdoc)
* @see dflydev\tests\markdown.AbstractParserTest::configureTabWidth()
*/
public function configureTabWidth(\dflydev\markdown\IMarkdownParser $markdownParser, $width)
{
$this->markTestSkipped('Sundown cannot configure tab width');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment